├── CMakeLists.txt ├── README ├── cookbook ├── CMakeLists.txt ├── chapter10 │ ├── CMakeLists.txt │ ├── ch10_01 │ │ └── delaunay.cpp │ ├── ch10_02 │ │ └── pseudo_loader.cpp │ ├── ch10_03 │ │ └── meta_data.cpp │ ├── ch10_04 │ │ └── custom_serializer.cpp │ ├── ch10_05 │ │ ├── BinaryStreamOperator.h │ │ └── class_reflection.cpp │ ├── ch10_06 │ │ └── capture_screen.cpp │ ├── ch10_07 │ │ ├── PointIntersector │ │ ├── PointIntersector.cpp │ │ └── main.cpp │ ├── ch10_08 │ │ └── depth_peeling.cpp │ └── ch10_09 │ │ ├── cliTest.cpp │ │ ├── osgWindow.cpp │ │ └── osgWindow.h ├── chapter2 │ ├── CMakeLists.txt │ ├── ch02_01 │ │ └── observer_ptr.cpp │ ├── ch02_02 │ │ └── clone_objects.cpp │ ├── ch02_03 │ │ └── bounding_box.cpp │ ├── ch02_04 │ │ └── running_car.cpp │ ├── ch02_05 │ │ └── mirror_scene.cpp │ ├── ch02_06 │ │ ├── BFSVisitor │ │ ├── BFSVisitor.cpp │ │ └── main.cpp │ ├── ch02_07 │ │ ├── BgImageNode │ │ ├── BgImageNode.cpp │ │ └── background_image.cpp │ ├── ch02_08 │ │ └── billboard_node.cpp │ ├── ch02_09 │ │ ├── CgCallbacks │ │ ├── CgCallbacks.cpp │ │ └── main.cpp │ └── ch02_10 │ │ ├── Compass │ │ ├── Compass.cpp │ │ └── main.cpp ├── chapter3 │ ├── CMakeLists.txt │ ├── ch03_01 │ │ └── draw_polygon.cpp │ ├── ch03_02 │ │ └── extrusion.cpp │ ├── ch03_03 │ │ ├── NurbsSurface │ │ ├── NurbsSurface.cpp │ │ └── main.cpp │ ├── ch03_04 │ │ └── clock_face.cpp │ ├── ch03_05 │ │ └── dynamic_ribbon.cpp │ ├── ch03_06 │ │ └── select_model.cpp │ ├── ch03_07 │ │ └── select_face.cpp │ ├── ch03_08 │ │ └── select_point.cpp │ ├── ch03_09 │ │ └── vertex_displacement.cpp │ └── ch03_10 │ │ └── draw_instanced.cpp ├── chapter4 │ ├── CMakeLists.txt │ ├── ch04_01 │ │ └── multiple_screen.cpp │ ├── ch04_02 │ │ └── power_wall.cpp │ ├── ch04_03 │ │ └── depth_partition.cpp │ ├── ch04_04 │ │ └── radar_map.cpp │ ├── ch04_05 │ │ └── four_views.cpp │ ├── ch04_06 │ │ └── control_four_views.cpp │ ├── ch04_07 │ │ └── follow_model.cpp │ ├── ch04_08 │ │ └── tracker_manipulator.cpp │ ├── ch04_09 │ │ ├── TwoDimManipulator │ │ ├── TwoDimManipulator.cpp │ │ └── main.cpp │ └── ch04_10 │ │ ├── JoystickManipulator │ │ ├── JoystickManipulator.cpp │ │ └── main.cpp ├── chapter5 │ ├── CMakeLists.txt │ ├── ch05_01 │ │ └── door_animation.cpp │ ├── ch05_02 │ │ └── movie_texture.cpp │ ├── ch05_03 │ │ └── scroll_texts.cpp │ ├── ch05_04 │ │ └── morph_geometry.cpp │ ├── ch05_05 │ │ └── fade_inout.cpp │ ├── ch05_06 │ │ └── cessna_fire.cpp │ ├── ch05_07 │ │ └── dynamic_light.cpp │ ├── ch05_08 │ │ ├── Player │ │ ├── Player.cpp │ │ └── main.cpp │ ├── ch05_09 │ │ └── simple_skeleton.cpp │ ├── ch05_10 │ │ └── bind_skin.cpp │ └── ch05_11 │ │ ├── PhysXInterface │ │ ├── PhysXInterface.cpp │ │ └── main.cpp ├── chapter6 │ ├── CMakeLists.txt │ ├── ch06_01 │ │ └── bump_mapping.cpp │ ├── ch06_02 │ │ └── shadow.cpp │ ├── ch06_03 │ │ └── multipass.cpp │ ├── ch06_04 │ │ └── read_depth.cpp │ ├── ch06_05 │ │ └── night_vision.cpp │ ├── ch06_06 │ │ └── depth_of_field.cpp │ ├── ch06_07 │ │ ├── SkyBox │ │ ├── SkyBox.cpp │ │ └── main.cpp │ ├── ch06_08 │ │ └── simple_water.cpp │ ├── ch06_09 │ │ ├── CloudBlock │ │ ├── CloudBlock.cpp │ │ └── main.cpp │ ├── ch06_10 │ │ ├── CgProgram │ │ ├── CgProgram.cpp │ │ └── main.cpp │ ├── ch06_11 │ │ └── g_buffer.cpp │ └── ch06_12 │ │ └── deferred_shading.cpp ├── chapter8 │ ├── CMakeLists.txt │ ├── ch08_01 │ │ └── merge_geom.cpp │ ├── ch08_02 │ │ └── compress_texture.cpp │ ├── ch08_03 │ │ └── share_objects.cpp │ ├── ch08_04 │ │ └── config_pager.cpp │ ├── ch08_05 │ │ ├── MazeCullCallback │ │ ├── MazeCullCallback.cpp │ │ └── main.cpp │ ├── ch08_06 │ │ └── occlusion_query.cpp │ ├── ch08_07 │ │ ├── OctreeBuilder │ │ ├── OctreeBuilder.cpp │ │ └── main.cpp │ ├── ch08_08 │ │ └── render_points.cpp │ └── ch08_09 │ │ └── intersection.cpp ├── chapter9 │ ├── CMakeLists.txt │ ├── ch09_01 │ │ └── osg_qt.cpp │ ├── ch09_02 │ │ └── osg_qthread.cpp │ ├── ch09_03 │ │ └── osg_qtwidgets.cpp │ ├── ch09_04 │ │ ├── CEGUIDrawable │ │ ├── CEGUIDrawable.cpp │ │ └── main.cpp │ ├── ch09_05 │ │ └── osg_widgets.cpp │ ├── ch09_06 │ │ └── osg_in_glut.cpp │ ├── ch09_08 │ │ ├── CMakeLists.txt │ │ ├── Factory.cpp │ │ ├── Mac │ │ │ ├── bundle_template │ │ │ │ ├── Info.plist │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── Localized.r │ │ │ └── projectDef.cmake │ │ ├── PluginConfig.cmake │ │ ├── Win │ │ │ ├── WiX │ │ │ │ └── osgWebInstaller.wxs │ │ │ └── projectDef.cmake │ │ ├── X11 │ │ │ └── projectDef.cmake │ │ ├── osgWeb.cpp │ │ ├── osgWeb.h │ │ ├── osgWebAPI.cpp │ │ └── osgWebAPI.h │ └── ch09_09 │ │ ├── CMakeLists.txt │ │ ├── Factory.cpp │ │ ├── Mac │ │ ├── bundle_template │ │ │ ├── Info.plist │ │ │ ├── InfoPlist.strings │ │ │ └── Localized.r │ │ └── projectDef.cmake │ │ ├── PluginConfig.cmake │ │ ├── Win │ │ ├── WiX │ │ │ └── osgWebInstaller.wxs │ │ └── projectDef.cmake │ │ ├── X11 │ │ └── projectDef.cmake │ │ ├── osgWeb.cpp │ │ ├── osgWeb.h │ │ ├── osgWebAPI.cpp │ │ └── osgWebAPI.h ├── common │ ├── CommonFunctions │ └── CommonFunctions.cpp └── data │ ├── animation.gif │ ├── bullet.png │ ├── compass_needle.PNG │ ├── compass_plate.PNG │ ├── data.txt │ ├── enemy.png │ ├── files.txt │ ├── maze.txt │ ├── noise_tex.jpg │ ├── player.png │ ├── teapot.osg │ ├── water_DUDV.jpg │ └── water_NM.jpg ├── effectcompositor ├── CMakeLists.txt ├── Description.txt ├── EffectAnalysisHelper.cpp ├── EffectCompositor ├── EffectCompositor.cpp ├── EffectCompositorXML.cpp ├── SkyBox ├── SkyBox.cpp ├── colorgrading.xml ├── dof.xml ├── hdr.xml ├── motionblur.xml ├── nightvision.xml ├── noise_tex.jpg ├── osgeffectcompositor.cpp ├── pessao.xml ├── smaa.xml ├── smaa │ ├── blend.fs │ ├── blend.vs │ ├── edgedetection.fs │ ├── edgedetection.vs │ ├── neighborhood.fs │ ├── neighborhood.vs │ ├── smaa_area.raw │ └── smaa_search.raw └── ssao.xml └── integrations ├── CMakeLists.txt ├── FindALVAR.cmake ├── FindGLEW.cmake ├── FindOpenCV.cmake ├── data ├── explosion.bmp ├── fernleaf.tga ├── fire2.bmp ├── fixedfont.bmp ├── flare.bmp ├── flash.bmp ├── greenleaf.tga ├── nav_test.obj ├── palm.ngp ├── point.bmp ├── simplefern.ngp ├── smoke.png ├── spark1.bmp ├── spdcactus.ngp ├── waterdrops.bmp └── wave.bmp ├── osgagg ├── CMakeLists.txt ├── Drawer2D.cpp ├── Drawer2D.h ├── agg │ ├── agg_alpha_mask_u8.h │ ├── agg_arc.cpp │ ├── agg_arc.h │ ├── agg_array.h │ ├── agg_arrowhead.cpp │ ├── agg_arrowhead.h │ ├── agg_basics.h │ ├── agg_bezier_arc.cpp │ ├── agg_bezier_arc.h │ ├── agg_bitset_iterator.h │ ├── agg_blur.h │ ├── agg_bounding_rect.h │ ├── agg_bspline.cpp │ ├── agg_bspline.h │ ├── agg_clip_liang_barsky.h │ ├── agg_color_gray.h │ ├── agg_color_rgba.h │ ├── agg_config.h │ ├── agg_conv_adaptor_vcgen.h │ ├── agg_conv_adaptor_vpgen.h │ ├── agg_conv_bspline.h │ ├── agg_conv_clip_polygon.h │ ├── agg_conv_clip_polyline.h │ ├── agg_conv_close_polygon.h │ ├── agg_conv_concat.h │ ├── agg_conv_contour.h │ ├── agg_conv_curve.h │ ├── agg_conv_dash.h │ ├── agg_conv_gpc.h │ ├── agg_conv_marker.h │ ├── agg_conv_marker_adaptor.h │ ├── agg_conv_segmentator.h │ ├── agg_conv_shorten_path.h │ ├── agg_conv_smooth_poly1.h │ ├── agg_conv_stroke.h │ ├── agg_conv_transform.h │ ├── agg_conv_unclose_polygon.h │ ├── agg_curves.cpp │ ├── agg_curves.h │ ├── agg_dda_line.h │ ├── agg_ellipse.h │ ├── agg_ellipse_bresenham.h │ ├── agg_embedded_raster_fonts.cpp │ ├── agg_embedded_raster_fonts.h │ ├── agg_font_cache_manager.h │ ├── agg_gamma_functions.h │ ├── agg_gamma_lut.h │ ├── agg_glyph_raster_bin.h │ ├── agg_gradient_lut.h │ ├── agg_gsv_text.cpp │ ├── agg_gsv_text.h │ ├── agg_image_accessors.h │ ├── agg_image_filters.cpp │ ├── agg_image_filters.h │ ├── agg_line_aa_basics.cpp │ ├── agg_line_aa_basics.h │ ├── agg_line_profile_aa.cpp │ ├── agg_math.h │ ├── agg_math_stroke.h │ ├── agg_path_length.h │ ├── agg_path_storage.h │ ├── agg_path_storage_integer.h │ ├── agg_pattern_filters_rgba.h │ ├── agg_pixfmt_amask_adaptor.h │ ├── agg_pixfmt_gray.h │ ├── agg_pixfmt_rgb.h │ ├── agg_pixfmt_rgb_packed.h │ ├── agg_pixfmt_rgba.h │ ├── agg_pixfmt_transposer.h │ ├── agg_rasterizer_cells_aa.h │ ├── agg_rasterizer_compound_aa.h │ ├── agg_rasterizer_outline.h │ ├── agg_rasterizer_outline_aa.h │ ├── agg_rasterizer_scanline_aa.h │ ├── agg_rasterizer_sl_clip.h │ ├── agg_renderer_base.h │ ├── agg_renderer_markers.h │ ├── agg_renderer_mclip.h │ ├── agg_renderer_outline_aa.h │ ├── agg_renderer_outline_image.h │ ├── agg_renderer_primitives.h │ ├── agg_renderer_raster_text.h │ ├── agg_renderer_scanline.h │ ├── agg_rendering_buffer.h │ ├── agg_rendering_buffer_dynarow.h │ ├── agg_rounded_rect.cpp │ ├── agg_rounded_rect.h │ ├── agg_scanline_bin.h │ ├── agg_scanline_boolean_algebra.h │ ├── agg_scanline_p.h │ ├── agg_scanline_storage_aa.h │ ├── agg_scanline_storage_bin.h │ ├── agg_scanline_u.h │ ├── agg_shorten_path.h │ ├── agg_simul_eq.h │ ├── agg_span_allocator.h │ ├── agg_span_converter.h │ ├── agg_span_gouraud.h │ ├── agg_span_gouraud_gray.h │ ├── agg_span_gouraud_rgba.h │ ├── agg_span_gradient.h │ ├── agg_span_gradient_alpha.h │ ├── agg_span_image_filter.h │ ├── agg_span_image_filter_gray.h │ ├── agg_span_image_filter_rgb.h │ ├── agg_span_image_filter_rgba.h │ ├── agg_span_interpolator_adaptor.h │ ├── agg_span_interpolator_linear.h │ ├── agg_span_interpolator_persp.h │ ├── agg_span_interpolator_trans.h │ ├── agg_span_pattern_gray.h │ ├── agg_span_pattern_rgb.h │ ├── agg_span_pattern_rgba.h │ ├── agg_span_solid.h │ ├── agg_span_subdiv_adaptor.h │ ├── agg_sqrt_tables.cpp │ ├── agg_trans_affine.cpp │ ├── agg_trans_affine.h │ ├── agg_trans_bilinear.h │ ├── agg_trans_double_path.cpp │ ├── agg_trans_double_path.h │ ├── agg_trans_perspective.h │ ├── agg_trans_single_path.cpp │ ├── agg_trans_single_path.h │ ├── agg_trans_viewport.h │ ├── agg_trans_warp_magnifier.cpp │ ├── agg_trans_warp_magnifier.h │ ├── agg_vcgen_bspline.cpp │ ├── agg_vcgen_bspline.h │ ├── agg_vcgen_contour.cpp │ ├── agg_vcgen_contour.h │ ├── agg_vcgen_dash.cpp │ ├── agg_vcgen_dash.h │ ├── agg_vcgen_markers_term.cpp │ ├── agg_vcgen_markers_term.h │ ├── agg_vcgen_smooth_poly1.cpp │ ├── agg_vcgen_smooth_poly1.h │ ├── agg_vcgen_stroke.cpp │ ├── agg_vcgen_stroke.h │ ├── agg_vcgen_vertex_sequence.h │ ├── agg_vertex_sequence.h │ ├── agg_vpgen_clip_polygon.cpp │ ├── agg_vpgen_clip_polygon.h │ ├── agg_vpgen_clip_polyline.cpp │ ├── agg_vpgen_clip_polyline.h │ ├── agg_vpgen_segmentator.cpp │ ├── agg_vpgen_segmentator.h │ ├── copying │ ├── ctrl │ │ ├── agg_bezier_ctrl.cpp │ │ ├── agg_bezier_ctrl.h │ │ ├── agg_cbox_ctrl.cpp │ │ ├── agg_cbox_ctrl.h │ │ ├── agg_ctrl.h │ │ ├── agg_gamma_ctrl.cpp │ │ ├── agg_gamma_ctrl.h │ │ ├── agg_gamma_spline.cpp │ │ ├── agg_gamma_spline.h │ │ ├── agg_polygon_ctrl.cpp │ │ ├── agg_polygon_ctrl.h │ │ ├── agg_rbox_ctrl.cpp │ │ ├── agg_rbox_ctrl.h │ │ ├── agg_scale_ctrl.cpp │ │ ├── agg_scale_ctrl.h │ │ ├── agg_slider_ctrl.cpp │ │ ├── agg_slider_ctrl.h │ │ ├── agg_spline_ctrl.cpp │ │ └── agg_spline_ctrl.h │ ├── font_freetype │ │ ├── agg_font_freetype.cpp │ │ └── agg_font_freetype.h │ ├── font_win32_tt │ │ ├── agg_font_win32_tt.cpp │ │ └── agg_font_win32_tt.h │ ├── gpc │ │ ├── VERSIONS.TXT │ │ ├── copying.txt │ │ ├── gpc.c │ │ └── gpc.h │ └── util │ │ ├── agg_color_conv.h │ │ ├── agg_color_conv_rgb16.h │ │ └── agg_color_conv_rgb8.h └── osgagg.cpp ├── osgalvar ├── CMakeLists.txt └── osgalvar.cpp ├── osganttweakbar ├── CMakeLists.txt └── osganttweakbar.cpp ├── osgawesomium ├── CMakeLists.txt └── osgawesomium.cpp ├── osgberkelium ├── CMakeLists.txt └── osgberkelium.cpp ├── osgbox2d ├── CMakeLists.txt └── osgbox2d.cpp ├── osgbullet ├── BulletInterface.cpp ├── BulletInterface.h ├── CMakeLists.txt └── osgbullet.cpp ├── osgcef ├── CMakeLists.txt └── osgcef.cpp ├── osgdb_assimp ├── CMakeLists.txt └── ReaderWriterAssImp.cpp ├── osgdb_cdr ├── CMakeLists.txt └── ReaderWriterCDR.cpp ├── osgdb_freeimage ├── CMakeLists.txt └── ReaderWriterFreeImage.cpp ├── osgdb_ngp ├── CMakeLists.txt ├── CMakeModules │ ├── CMakeMacros.cmake │ ├── FindNGPCORE.cmake │ └── ModuleInstall.cmake └── src │ ├── CMakeLists.txt │ └── osgdb_ngp │ ├── CMakeLists.txt │ ├── NgpFileName.cpp │ ├── NgpFileName.h │ ├── ReaderWriterNgp.cpp │ ├── UtlString.cpp │ └── UtlString.h ├── osgdb_otl ├── CMakeLists.txt ├── ReaderWriterOTL.cpp ├── osgotl.cpp └── otlv4.h ├── osgdb_physfs ├── CMakeLists.txt └── ReaderWriterPhysFS.cpp ├── osgdirectwrite ├── CMakeLists.txt ├── DirectWriteImage.cpp ├── DirectWriteImage.h ├── GdiTextRenderer.cpp ├── GdiTextRenderer.h └── osgdirectwrite.cpp ├── osgflex ├── CMakeLists.txt ├── FlexDrawable.cpp ├── FlexDrawable.h └── osgflex.cpp ├── osggiworks ├── CMakeLists.txt └── osggiworks.cpp ├── osggizmo ├── CMakeLists.txt └── osggizmo.cpp ├── osgguichan ├── CMakeLists.txt ├── GuichanWrapper.cpp ├── GuichanWrapper.h ├── guichan.hpp ├── guichan │ ├── COPYING │ ├── actionevent.cpp │ ├── actionevent.hpp │ ├── actionlistener.hpp │ ├── cliprectangle.cpp │ ├── cliprectangle.hpp │ ├── color.cpp │ ├── color.hpp │ ├── containerevent.cpp │ ├── containerevent.hpp │ ├── containerlistener.hpp │ ├── deathlistener.hpp │ ├── defaultfont.cpp │ ├── defaultfont.hpp │ ├── event.cpp │ ├── event.hpp │ ├── exception.cpp │ ├── exception.hpp │ ├── focushandler.cpp │ ├── focushandler.hpp │ ├── focuslistener.hpp │ ├── font.cpp │ ├── font.hpp │ ├── genericinput.cpp │ ├── genericinput.hpp │ ├── graphics.cpp │ ├── graphics.hpp │ ├── gui.cpp │ ├── gui.hpp │ ├── guichan.cpp │ ├── image.cpp │ ├── image.hpp │ ├── imagefont.cpp │ ├── imagefont.hpp │ ├── imageloader.hpp │ ├── input.hpp │ ├── inputevent.cpp │ ├── inputevent.hpp │ ├── key.cpp │ ├── key.hpp │ ├── keyevent.cpp │ ├── keyevent.hpp │ ├── keyinput.cpp │ ├── keyinput.hpp │ ├── keylistener.hpp │ ├── listmodel.hpp │ ├── mouseevent.cpp │ ├── mouseevent.hpp │ ├── mouseinput.cpp │ ├── mouseinput.hpp │ ├── mouselistener.hpp │ ├── opengl.hpp │ ├── opengl │ │ ├── opengl.cpp │ │ ├── openglallegroimageloader.hpp │ │ ├── openglgraphics.cpp │ │ ├── openglgraphics.hpp │ │ ├── openglimage.cpp │ │ ├── openglimage.hpp │ │ └── openglsdlimageloader.hpp │ ├── platform.hpp │ ├── rectangle.cpp │ ├── rectangle.hpp │ ├── selectionevent.cpp │ ├── selectionevent.hpp │ ├── selectionlistener.hpp │ ├── text.cpp │ ├── text.hpp │ ├── widget.cpp │ ├── widget.hpp │ ├── widgetlistener.hpp │ └── widgets │ │ ├── Makefile.am │ │ ├── button.cpp │ │ ├── button.hpp │ │ ├── checkbox.cpp │ │ ├── checkbox.hpp │ │ ├── container.cpp │ │ ├── container.hpp │ │ ├── dropdown.cpp │ │ ├── dropdown.hpp │ │ ├── icon.cpp │ │ ├── icon.hpp │ │ ├── imagebutton.cpp │ │ ├── imagebutton.hpp │ │ ├── label.cpp │ │ ├── label.hpp │ │ ├── listbox.cpp │ │ ├── listbox.hpp │ │ ├── radiobutton.cpp │ │ ├── radiobutton.hpp │ │ ├── scrollarea.cpp │ │ ├── scrollarea.hpp │ │ ├── slider.cpp │ │ ├── slider.hpp │ │ ├── tab.cpp │ │ ├── tab.hpp │ │ ├── tabbedarea.cpp │ │ ├── tabbedarea.hpp │ │ ├── textbox.cpp │ │ ├── textbox.hpp │ │ ├── textfield.cpp │ │ ├── textfield.hpp │ │ ├── window.cpp │ │ └── window.hpp └── osgguichan.cpp ├── osgmicropather ├── CMakeLists.txt ├── micropather.cpp ├── micropather.h └── osgmicropather.cpp ├── osgmskinect ├── CMakeLists.txt ├── KinectHandler.cpp ├── KinectHandler.h └── osgmskinect.cpp ├── osgmygui ├── CMakeLists.txt ├── MYGUIManager.cpp ├── MYGUIManager.h └── osgmygui.cpp ├── osgnanovg ├── CMakeLists.txt ├── LICENSE.txt ├── nanovg │ ├── fontstash.h │ ├── nanovg.c │ ├── nanovg.h │ ├── nanovg_gl.h │ ├── nanovg_gl_utils.h │ ├── stb_image.h │ └── stb_truetype.h └── osgnanovg.cpp ├── osgngplant ├── CMakeLists.txt ├── COPYING ├── COPYING.BSD ├── ngpcore │ ├── SConscript │ ├── p3dbalgbase.cpp │ ├── p3dbalgbase.h │ ├── p3dbalgstd.cpp │ ├── p3dbalgstd.h │ ├── p3dbalgwings.cpp │ ├── p3dbalgwings.h │ ├── p3dcompat.h │ ├── p3ddefs.h │ ├── p3dexcept.cpp │ ├── p3dexcept.h │ ├── p3dgmeshdata.cpp │ ├── p3dgmeshdata.h │ ├── p3dhli.cpp │ ├── p3dhli.h │ ├── p3diostream.cpp │ ├── p3diostream.h │ ├── p3diostreamadd.cpp │ ├── p3diostreamadd.h │ ├── p3dmath.cpp │ ├── p3dmath.h │ ├── p3dmathrng.cpp │ ├── p3dmathrng.h │ ├── p3dmathspline.cpp │ ├── p3dmathspline.h │ ├── p3dmodel.cpp │ ├── p3dmodel.h │ ├── p3dmodelstemgmesh.cpp │ ├── p3dmodelstemgmesh.h │ ├── p3dmodelstemquad.cpp │ ├── p3dmodelstemquad.h │ ├── p3dmodelstemtube.cpp │ ├── p3dmodelstemtube.h │ ├── p3dmodelstemwings.cpp │ ├── p3dmodelstemwings.h │ ├── p3dplant.cpp │ ├── p3dplant.h │ └── p3dtypes.h └── osgngplant.cpp ├── osgnikinect ├── CMakeLists.txt ├── KinectHandler.cpp ├── KinectHandler.h └── osgnikinect.cpp ├── osgnvfx ├── CMakeLists.txt └── osgnvfx.cpp ├── osgperceptual ├── CMakeLists.txt └── osgperceptual.cpp ├── osgphysx3 ├── CMakeLists.txt ├── PhysXInterface.cpp ├── PhysXInterface.h ├── PxTkStream.cpp ├── PxTkStream.h ├── SampleCloth.cpp └── osgphysx3.cpp ├── osgrecast ├── CMakeLists.txt ├── ChunkyTriMesh.cpp ├── ChunkyTriMesh.h ├── License.txt ├── Recast │ ├── DebugDraw.cpp │ ├── DebugDraw.h │ ├── DetourAlloc.cpp │ ├── DetourAlloc.h │ ├── DetourAssert.h │ ├── DetourCommon.cpp │ ├── DetourCommon.h │ ├── DetourCrowd.cpp │ ├── DetourCrowd.h │ ├── DetourDebugDraw.cpp │ ├── DetourDebugDraw.h │ ├── DetourLocalBoundary.cpp │ ├── DetourLocalBoundary.h │ ├── DetourMath.h │ ├── DetourNavMesh.cpp │ ├── DetourNavMesh.h │ ├── DetourNavMeshBuilder.cpp │ ├── DetourNavMeshBuilder.h │ ├── DetourNavMeshQuery.cpp │ ├── DetourNavMeshQuery.h │ ├── DetourNode.cpp │ ├── DetourNode.h │ ├── DetourObstacleAvoidance.cpp │ ├── DetourObstacleAvoidance.h │ ├── DetourPathCorridor.cpp │ ├── DetourPathCorridor.h │ ├── DetourPathQueue.cpp │ ├── DetourPathQueue.h │ ├── DetourProximityGrid.cpp │ ├── DetourProximityGrid.h │ ├── DetourStatus.h │ ├── DetourTileCache.cpp │ ├── DetourTileCache.h │ ├── DetourTileCacheBuilder.cpp │ ├── DetourTileCacheBuilder.h │ ├── Recast.cpp │ ├── Recast.h │ ├── RecastAlloc.cpp │ ├── RecastAlloc.h │ ├── RecastArea.cpp │ ├── RecastAssert.h │ ├── RecastContour.cpp │ ├── RecastDebugDraw.cpp │ ├── RecastDebugDraw.h │ ├── RecastDump.cpp │ ├── RecastDump.h │ ├── RecastFilter.cpp │ ├── RecastLayers.cpp │ ├── RecastMesh.cpp │ ├── RecastMeshDetail.cpp │ ├── RecastRasterization.cpp │ └── RecastRegion.cpp ├── RecastManager.cpp ├── RecastManager.h └── osgrecast.cpp ├── osgrvo2 ├── CMakeLists.txt └── osgrvo2.cpp ├── osgshadowworks ├── CMakeLists.txt └── osgshadowworks.cpp ├── osgsilverlining ├── CMakeLists.txt ├── SilverLiningNode.cpp ├── SilverLiningNode.h └── osgsilverlining.cpp ├── osgsmartbody ├── CMakeLists.txt └── osgsmartbody.cpp ├── osgspark ├── CMakeLists.txt ├── SparkDrawable.cpp ├── SparkDrawable.h ├── SparkUpdatingHandler.cpp ├── SparkUpdatingHandler.h ├── explosion_effect.cpp ├── fire_effect.cpp ├── osgspark.cpp ├── rain_effect.cpp └── simple_effect.cpp ├── osgswiftpp ├── CMakeLists.txt ├── LICENSE ├── SWIFT.h ├── SWIFT_array.h ├── SWIFT_boxnode.h ├── SWIFT_common.h ├── SWIFT_config.h ├── SWIFT_fileio.h ├── SWIFT_front.h ├── SWIFT_linalg.h ├── SWIFT_lut.h ├── SWIFT_mesh.h ├── SWIFT_mesh_utils.h ├── SWIFT_object.h ├── SWIFT_pair.h ├── SWIFT_pqueue.h ├── fileio.cpp ├── lut.cpp ├── mesh.cpp ├── mesh_utils.cpp ├── object.cpp ├── osgswiftpp.cpp ├── pair.cpp ├── pqueue.cpp ├── qhull │ ├── COPYING.txt │ ├── geom.c │ ├── geom.h │ ├── geom2.c │ ├── global.c │ ├── io.c │ ├── io.h │ ├── libqhull.c │ ├── libqhull.h │ ├── libqhull.pro │ ├── mem.c │ ├── mem.h │ ├── merge.c │ ├── merge.h │ ├── poly.c │ ├── poly.h │ ├── poly2.c │ ├── qhull_a.h │ ├── qset.c │ ├── qset.h │ ├── random.c │ ├── random.h │ ├── rboxlib.c │ ├── stat.c │ ├── stat.h │ ├── user.c │ ├── user.h │ ├── usermem.c │ ├── userprintf.c │ └── userprintf_rbox.c └── scene.cpp ├── osgtriton ├── CMakeLists.txt ├── TritonNode.cpp ├── TritonNode.h └── osgtriton.cpp ├── osgtuio ├── CMakeLists.txt ├── TUIO │ ├── DevReceiver.cpp │ ├── DevReceiver.h │ ├── DevSender.cpp │ ├── DevSender.h │ ├── Doxyfile │ ├── FlashSender.cpp │ ├── FlashSender.h │ ├── LibExport.h │ ├── OscReceiver.cpp │ ├── OscReceiver.h │ ├── OscSender.cpp │ ├── OscSender.h │ ├── TcpReceiver.cpp │ ├── TcpReceiver.h │ ├── TcpSender.cpp │ ├── TcpSender.h │ ├── TuioBlob.cpp │ ├── TuioBlob.h │ ├── TuioClient.cpp │ ├── TuioClient.h │ ├── TuioContainer.cpp │ ├── TuioContainer.h │ ├── TuioCursor.cpp │ ├── TuioCursor.h │ ├── TuioDispatcher.cpp │ ├── TuioDispatcher.h │ ├── TuioListener.h │ ├── TuioManager.cpp │ ├── TuioManager.h │ ├── TuioObject.cpp │ ├── TuioObject.h │ ├── TuioPoint.cpp │ ├── TuioPoint.h │ ├── TuioServer.cpp │ ├── TuioServer.h │ ├── TuioTime.cpp │ ├── TuioTime.h │ ├── UdpReceiver.cpp │ ├── UdpReceiver.h │ ├── UdpSender.cpp │ └── UdpSender.h ├── oscpack │ ├── changes │ ├── ip │ │ ├── IpEndpointName.cpp │ │ ├── IpEndpointName.h │ │ ├── NetworkingUtils.h │ │ ├── PacketListener.h │ │ ├── TimerListener.h │ │ ├── UdpSocket.h │ │ ├── posix │ │ │ ├── NetworkingUtils.cpp │ │ │ └── UdpSocket.cpp │ │ └── win32 │ │ │ ├── NetworkingUtils.cpp │ │ │ └── UdpSocket.cpp │ ├── license │ ├── osc │ │ ├── MessageMappingOscPacketListener.h │ │ ├── OscException.h │ │ ├── OscHostEndianness.h │ │ ├── OscOutboundPacketStream.cpp │ │ ├── OscOutboundPacketStream.h │ │ ├── OscPacketListener.h │ │ ├── OscPrintReceivedElements.cpp │ │ ├── OscPrintReceivedElements.h │ │ ├── OscReceivedElements.cpp │ │ ├── OscReceivedElements.h │ │ ├── OscTypes.cpp │ │ └── OscTypes.h │ ├── readme │ └── todo └── osgtuio.cpp └── osgvlc ├── CMakeLists.txt ├── VideoPlayer.cpp ├── VideoPlayer.h └── osgvlc.cpp /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(osgRecipes) 2 | 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7) 4 | SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix for Debug mode, usually d on windows") 5 | 6 | IF(COMMAND CMAKE_POLICY) 7 | CMAKE_POLICY(SET CMP0003 NEW) 8 | ENDIF(COMMAND CMAKE_POLICY) 9 | 10 | # The OpenSceneGraph 3.0 Cookbook Source code 11 | OPTION(BUILD_COOKBOOK "Build Cookbook Examples" ON) 12 | IF(BUILD_COOKBOOK) 13 | ADD_SUBDIRECTORY(cookbook) 14 | ENDIF(BUILD_COOKBOOK) 15 | 16 | # The integration examples 17 | OPTION(BUILD_INTEGRATIONS "Build integrations of OSG and other APIs" ON) 18 | IF(BUILD_INTEGRATIONS) 19 | ADD_SUBDIRECTORY(integrations) 20 | ENDIF(BUILD_INTEGRATIONS) 21 | 22 | OPTION(BUILD_TESTS "Build experimental components" ON) 23 | IF(BUILD_TESTS) 24 | # The shader effect compositor in progress 25 | ADD_SUBDIRECTORY(effectcompositor) 26 | ENDIF(BUILD_TESTS) 27 | -------------------------------------------------------------------------------- /cookbook/chapter10/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example 1: Playing with the Delaunay triangulator 2 | SET(EXAMPLE_NAME cookbook_10_01) 3 | SET(EXAMPLE_FILES ch10_01/delaunay.cpp) 4 | START_EXAMPLE() 5 | 6 | # Example 2: Understanding and using the pseudo-loaders 7 | SET(EXAMPLE_NAME cookbook_10_02) 8 | SET(EXAMPLE_FILES ch10_02/pseudo_loader.cpp) 9 | START_EXAMPLE() 10 | 11 | # Example 3: Managing customized data with the metadata system 12 | SET(EXAMPLE_NAME cookbook_10_03) 13 | SET(EXAMPLE_FILES ch10_03/meta_data.cpp) 14 | START_EXAMPLE() 15 | 16 | # Example 4: Designing customized serializers 17 | SET(EXAMPLE_NAME cookbook_10_04) 18 | SET(EXAMPLE_FILES ch10_04/custom_serializer.cpp) 19 | START_EXAMPLE() 20 | 21 | # Example 5: Reflecting classes with serializers 22 | SET(EXAMPLE_NAME cookbook_10_05) 23 | SET(EXAMPLE_FILES ch10_05/class_reflection.cpp) 24 | START_EXAMPLE() 25 | 26 | # Example 6: Taking a photo of the scene 27 | SET(EXAMPLE_NAME cookbook_10_06) 28 | SET(EXAMPLE_FILES ch10_06/capture_screen.cpp) 29 | START_EXAMPLE() 30 | 31 | # Example 7: Designing customized intersectors 32 | SET(EXAMPLE_NAME cookbook_10_07) 33 | SET(EXAMPLE_FILES ch10_07/main.cpp 34 | ch10_07/PointIntersector.cpp 35 | ch10_07/PointIntersector) 36 | START_EXAMPLE() 37 | 38 | # Example 8: Implementing the depth peeling method 39 | SET(EXAMPLE_NAME cookbook_10_08) 40 | SET(EXAMPLE_FILES ch10_08/depth_peeling.cpp) 41 | START_EXAMPLE() 42 | 43 | # Example 9: Using OSG in C++/CLI applications 44 | 45 | # Example 10: Using osgSwig for language binding 46 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_01/delaunay.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 10 Recipe 1 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "CommonFunctions" 13 | 14 | int main( int argc, char** argv ) 15 | { 16 | osg::ref_ptr va = new osg::Vec3Array(9); 17 | (*va)[0].set(-5.0f,-5.0f, 0.4f); 18 | (*va)[1].set( 1.0f,-5.6f, 0.0f); 19 | (*va)[2].set( 5.0f,-4.0f,-0.5f); 20 | (*va)[3].set(-6.2f, 0.0f, 4.2f); 21 | (*va)[4].set(-1.0f,-0.5f, 4.8f); 22 | (*va)[5].set( 4.3f, 1.0f, 3.0f); 23 | (*va)[6].set(-4.8f, 5.4f, 0.3f); 24 | (*va)[7].set( 0.6f, 5.1f,-0.8f); 25 | (*va)[8].set( 5.2f, 4.5f, 0.1f); 26 | 27 | osg::ref_ptr dt = new osgUtil::DelaunayTriangulator; 28 | dt->setInputPointArray( va.get() ); 29 | dt->setOutputNormalArray( new osg::Vec3Array ); 30 | dt->triangulate(); 31 | 32 | osg::ref_ptr geometry = new osg::Geometry; 33 | geometry->setVertexArray( dt->getInputPointArray() ); 34 | geometry->setNormalArray( dt->getOutputNormalArray() ); 35 | geometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE ); 36 | geometry->addPrimitiveSet( dt->getTriangles() ); 37 | 38 | osg::ref_ptr geode = new osg::Geode; 39 | geode->addDrawable( geometry.get() ); 40 | 41 | osgViewer::Viewer viewer; 42 | viewer.setSceneData( geode.get() ); 43 | return viewer.run(); 44 | } 45 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_02/pseudo_loader.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 10 Recipe 2 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "CommonFunctions" 15 | 16 | class ReaderWriterSIMP : public osgDB::ReaderWriter 17 | { 18 | public: 19 | ReaderWriterSIMP() { supportsExtension("simp", "Simplification Pseudo-loader"); } 20 | 21 | virtual const char* className() const { return "simplification pseudo-loader"; } 22 | 23 | virtual bool acceptsExtension( const std::string& ext ) const 24 | { return osgDB::equalCaseInsensitive(ext, "simp"); } 25 | 26 | virtual ReadResult readNode( const std::string& fileName, 27 | const osgDB::ReaderWriter::Options* options ) const 28 | { 29 | std::string ext = osgDB::getLowerCaseFileExtension(fileName); 30 | if ( !acceptsExtension(ext) ) return ReadResult::FILE_NOT_HANDLED; 31 | 32 | double ratio = 1.0; 33 | if ( options ) 34 | { 35 | std::stringstream ss( options->getOptionString() ); 36 | ss >> ratio; 37 | } 38 | 39 | osg::Node* scene = osgDB::readNodeFile( osgDB::getNameLessExtension(fileName) ); 40 | if ( scene ) 41 | { 42 | osgUtil::Simplifier simplifier(ratio); 43 | scene->accept( simplifier ); 44 | } 45 | return scene; 46 | } 47 | }; 48 | 49 | REGISTER_OSGPLUGIN( simp, ReaderWriterSIMP ) 50 | 51 | int main( int argc, char** argv ) 52 | { 53 | osg::ArgumentParser arguments( &argc, argv ); 54 | std::string ratioStr("0.2"); 55 | if ( argc>1 ) ratioStr = arguments[1]; 56 | 57 | osg::ref_ptr scene = osgDB::readNodeFile( 58 | "cow.osg.simp", new osgDB::ReaderWriter::Options(ratioStr) ); 59 | 60 | osgViewer::Viewer viewer; 61 | viewer.setSceneData( scene.get() ); 62 | return viewer.run(); 63 | } 64 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_03/meta_data.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 10 Recipe 3 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "CommonFunctions" 13 | 14 | class GetValueVisitor : public osg::ValueObject::GetValueVisitor 15 | { 16 | public: 17 | virtual void apply( bool value ) 18 | { std::cout << "Bool: " << value << std::endl; } 19 | 20 | virtual void apply( int value ) 21 | { std::cout << "Integer: " << value << std::endl; } 22 | 23 | virtual void apply( const std::string& value ) 24 | { std::cout << "String: " << value << std::endl; } 25 | 26 | virtual void apply( const osg::Matrix& value ) 27 | { std::cout << "Matrix: " << value << std::endl; } 28 | }; 29 | 30 | int main( int argc, char** argv ) 31 | { 32 | osg::Matrix matrix; 33 | matrix.makeRotate( osg::PI_2, osg::Z_AXIS ); 34 | 35 | osg::ref_ptr node = new osg::MatrixTransform; 36 | node->setMatrix( matrix ); 37 | node->setUserValue( "Creator", std::string("Rui Wang") ); 38 | node->setUserValue( "NodeID", 101 ); 39 | node->setUserValue( "IsMain", true ); 40 | node->setUserValue( "OriginMatrix", matrix ); 41 | 42 | osgDB::writeNodeFile( *node, "result.osgx" ); 43 | 44 | osg::UserDataContainer* udc = node->getOrCreateUserDataContainer(); 45 | for ( unsigned int i=0; igetNumUserObjects(); ++i ) 46 | { 47 | osg::ValueObject* valueObject = 48 | dynamic_cast( udc->getUserObject(i) ); 49 | if ( valueObject ) 50 | { 51 | GetValueVisitor gvv; 52 | valueObject->get( gvv ); 53 | } 54 | } 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_07/PointIntersector: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 10 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH10_POINTINTERSECTOR 7 | #define H_COOKBOOK_CH10_POINTINTERSECTOR 8 | 9 | #include 10 | 11 | class PointIntersector : public osgUtil::LineSegmentIntersector 12 | { 13 | public: 14 | PointIntersector(); 15 | PointIntersector( const osg::Vec3& start, const osg::Vec3& end ); 16 | PointIntersector( CoordinateFrame cf, double x, double y ); 17 | 18 | void setPickBias( float bias ) { _pickBias = bias; } 19 | float getPickBias() const { return _pickBias; } 20 | 21 | virtual Intersector* clone( osgUtil::IntersectionVisitor& iv ); 22 | virtual void intersect( osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable ); 23 | 24 | protected: 25 | virtual ~PointIntersector() {} 26 | float _pickBias; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_09/cliTest.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "osgWindow.h" 3 | 4 | using namespace System; 5 | using namespace System::Windows::Forms; 6 | 7 | int main(array ^args) 8 | { 9 | cliTest::osgWindow^ form = gcnew cliTest::osgWindow(); 10 | Application::Run(form); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_09/osgWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "osgWindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace System::Threading; 9 | 10 | osg::ref_ptr g_viewer; 11 | 12 | void cliTest::osgWindow::runThread() 13 | { 14 | Object^ dummyViewerObject = gcnew Object; 15 | while ( !g_viewer->done() ) 16 | { 17 | Monitor::Enter(dummyViewerObject); 18 | g_viewer->frame(); 19 | Monitor::Exit(dummyViewerObject); 20 | } 21 | } 22 | 23 | void cliTest::osgWindow::initializeOSG() 24 | { 25 | RECT rect; 26 | HWND hwnd = (HWND)Handle.ToInt32(); 27 | GetWindowRect( hwnd, &rect ); 28 | 29 | osg::ref_ptr traits=new osg::GraphicsContext::Traits; 30 | traits->x = 0; 31 | traits->y = 0; 32 | traits->width = rect.right - rect.left; 33 | traits->height = rect.bottom - rect.top; 34 | traits->windowDecoration = false; 35 | traits->doubleBuffer = true; 36 | traits->inheritedWindowData = new osgViewer::GraphicsWindowWin32::WindowData(hwnd); 37 | 38 | osg::ref_ptr camera = new osg::Camera; 39 | camera->setGraphicsContext( osg::GraphicsContext::createGraphicsContext(traits.get()) ); 40 | camera->setViewport( new osg::Viewport(0, 0, traits->width, traits->height) ); 41 | camera->setClearColor( osg::Vec4(0.2f, 0.2f, 0.6f, 1.0f) ); 42 | camera->setProjectionMatrixAsPerspective( 43 | 30.0f, static_cast(traits->width)/static_cast(traits->height), 1.0f, 10000.0f ); 44 | camera->setDrawBuffer( GL_BACK ); 45 | camera->setReadBuffer( GL_BACK ); 46 | 47 | g_viewer = new osgViewer::Viewer; 48 | g_viewer->setCameraManipulator( new osgGA::TrackballManipulator ); 49 | g_viewer->setCamera( camera.get() ); 50 | g_viewer->setSceneData( osgDB::readNodeFile("cessna.osg") ); 51 | 52 | System::Threading::Thread^ threadObject = gcnew System::Threading::Thread( 53 | gcnew System::Threading::ThreadStart(this, &cliTest::osgWindow::runThread) ); 54 | threadObject->Priority = Threading::ThreadPriority::BelowNormal; 55 | threadObject->Start(); 56 | } 57 | -------------------------------------------------------------------------------- /cookbook/chapter10/ch10_09/osgWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace cliTest { 4 | 5 | using namespace System; 6 | using namespace System::ComponentModel; 7 | using namespace System::Collections; 8 | using namespace System::Windows::Forms; 9 | using namespace System::Data; 10 | using namespace System::Drawing; 11 | 12 | public ref class osgWindow : public System::Windows::Forms::Form 13 | { 14 | public: 15 | osgWindow(void) 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | protected: 21 | ~osgWindow() 22 | { 23 | if (components) 24 | { 25 | delete components; 26 | } 27 | } 28 | 29 | void runThread(); 30 | void initializeOSG(); 31 | 32 | private: 33 | System::ComponentModel::Container ^components; 34 | 35 | #pragma region Windows Form Designer generated code 36 | void InitializeComponent(void) 37 | { 38 | this->SuspendLayout(); 39 | // 40 | // osgWindow 41 | // 42 | this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); 43 | this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 44 | this->ClientSize = System::Drawing::Size(284, 262); 45 | this->Name = L"osgWindow"; 46 | this->Text = L"osgWindow"; 47 | this->Load += gcnew System::EventHandler(this, &osgWindow::osgWindow_Load); 48 | this->ResumeLayout(false); 49 | 50 | } 51 | #pragma endregion 52 | private: System::Void osgWindow_Load(System::Object^ sender, System::EventArgs^ e) { 53 | initializeOSG(); 54 | } 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_05/mirror_scene.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 5 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main( int argc, char** argv ) 12 | { 13 | osg::ArgumentParser arguments( &argc, argv ); 14 | osg::ref_ptr scene = osgDB::readNodeFiles( arguments ); 15 | if ( !scene ) scene = osgDB::readNodeFile("cessna.osg"); 16 | 17 | float z = -10.0f; 18 | osg::ref_ptr reverse = new osg::MatrixTransform; 19 | reverse->preMult(osg::Matrix::translate(0.0f, 0.0f, -z) * 20 | osg::Matrix::scale(1.0f, 1.0f, -1.0f) * 21 | osg::Matrix::translate(0.0f, 0.0f, z) ); 22 | reverse->addChild( scene.get() ); 23 | 24 | osg::ref_ptr clipPlane = new osg::ClipPlane; 25 | clipPlane->setClipPlane( 0.0, 0.0, -1.0, z ); 26 | clipPlane->setClipPlaneNum( 0 ); 27 | 28 | osg::ref_ptr clipNode = new osg::ClipNode; 29 | clipNode->addClipPlane( clipPlane.get() ); 30 | clipNode->addChild( reverse.get() ); 31 | 32 | osg::ref_ptr root = new osg::Group; 33 | root->addChild( scene.get() ); 34 | root->addChild( clipNode.get() ); 35 | 36 | osgViewer::Viewer viewer; 37 | viewer.setSceneData( root.get() ); 38 | return viewer.run(); 39 | } 40 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_06/BFSVisitor: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 6 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH2_BFSVISITOR 7 | #define H_COOKBOOK_CH2_BFSVISITOR 8 | 9 | #include 10 | #include 11 | 12 | class BFSVisitor : public osg::NodeVisitor 13 | { 14 | public: 15 | BFSVisitor(); 16 | 17 | virtual void reset() { _pendingNodes.clear(); } 18 | virtual void apply( osg::Node& node ) { traverseBFS(node); } 19 | 20 | protected: 21 | virtual ~BFSVisitor(); 22 | 23 | void traverseBFS( osg::Node& node ); 24 | 25 | std::deque _pendingNodes; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_06/BFSVisitor.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 6 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include "BFSVisitor" 8 | 9 | BFSVisitor::BFSVisitor() 10 | : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) 11 | { 12 | } 13 | 14 | BFSVisitor::~BFSVisitor() 15 | { 16 | } 17 | 18 | void BFSVisitor::traverseBFS( osg::Node& node ) 19 | { 20 | osg::Group* group = node.asGroup(); 21 | if ( !group ) return; 22 | 23 | for ( unsigned int i=0; igetNumChildren(); ++i ) 24 | { 25 | _pendingNodes.push_back( group->getChild(i) ); 26 | } 27 | 28 | while ( _pendingNodes.size()>0 ) 29 | { 30 | osg::Node* node = _pendingNodes.front(); 31 | _pendingNodes.pop_front(); 32 | node->accept(*this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_06/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 6 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "BFSVisitor" 11 | 12 | class BFSPrintVisitor : public BFSVisitor 13 | { 14 | public: 15 | virtual void apply( osg::Node& node ) 16 | { 17 | std::cout << node.libraryName() << "::" << node.className() << std::endl; 18 | traverseBFS(node); 19 | } 20 | }; 21 | 22 | int main( int argc, char** argv ) 23 | { 24 | osg::ArgumentParser arguments( &argc, argv ); 25 | osg::ref_ptr root = osgDB::readNodeFiles( arguments ); 26 | if ( !root ) root = osgDB::readNodeFile("osgcool.osg"); 27 | 28 | std::cout << "DFS Visitor traversal: " << std::endl; 29 | 30 | osgUtil::PrintVisitor pv( std::cout ); 31 | root->accept( pv ); 32 | 33 | std::cout << std::endl; 34 | std::cout << "BFS Visitor traversal: " << std::endl; 35 | 36 | BFSPrintVisitor bpv; 37 | root->accept( bpv ); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_07/BgImageNode: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH2_BGIMAGENODE 7 | #define H_COOKBOOK_CH2_BGIMAGENODE 8 | 9 | #include 10 | 11 | class BgImageNode : public osg::Camera 12 | { 13 | public: 14 | CgStartCallback(); 15 | CgStartCallback( const CgStartCallback& copy, osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY ); 16 | META_Node( osg, CgStartCallback ); 17 | 18 | protected: 19 | virtual ~CgStartCallback(); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_07/BgImageNode.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include "BgImageNode" 7 | 8 | CgStartCallback::CgStartCallback() 9 | { 10 | } 11 | 12 | CgStartCallback::CgStartCallback( const CgStartCallback& copy, osg::CopyOp copyop ) 13 | : osg::Camera(copy, copyop) 14 | { 15 | } 16 | 17 | CgStartCallback::~CgStartCallback() 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_07/background_image.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int main( int argc, char** argv ) 14 | { 15 | osg::ref_ptr texture = new osg::Texture2D; 16 | osg::ref_ptr image = osgDB::readImageFile( "Images/osg256.png" ); 17 | texture->setImage( image.get() ); 18 | 19 | osg::ref_ptr quad = osg::createTexturedQuadGeometry( 20 | osg::Vec3(), osg::Vec3(1.0f, 0.0f, 0.0f), osg::Vec3(0.0f, 1.0f, 0.0f) ); 21 | quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() ); 22 | 23 | osg::ref_ptr geode = new osg::Geode; 24 | geode->addDrawable( quad.get() ); 25 | 26 | osg::ref_ptr camera = new osg::Camera; 27 | camera->setClearMask( 0 ); 28 | camera->setCullingActive( false ); 29 | camera->setAllowEventFocus( false ); 30 | camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF ); 31 | camera->setRenderOrder( osg::Camera::POST_RENDER ); 32 | camera->setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) ); 33 | camera->addChild( geode.get() ); 34 | 35 | osg::StateSet* ss = camera->getOrCreateStateSet(); 36 | ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 37 | ss->setAttributeAndModes( new osg::Depth(osg::Depth::LEQUAL, 1.0, 1.0) ); 38 | 39 | osg::ref_ptr root = new osg::Group; 40 | root->addChild( camera.get() ); 41 | root->addChild( osgDB::readNodeFile("cessna.osg") ); 42 | 43 | osgViewer::Viewer viewer; 44 | viewer.setSceneData( root.get() ); 45 | return viewer.run(); 46 | } 47 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_08/billboard_node.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 8 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class BillboardCallback : public osg::NodeCallback 12 | { 13 | public: 14 | BillboardCallback( osg::MatrixTransform* billboard ) 15 | : _billboardNode(billboard) {} 16 | 17 | virtual void operator()( osg::Node* node, osg::NodeVisitor* nv ) 18 | { 19 | osgUtil::CullVisitor* cv = dynamic_cast(nv); 20 | if ( _billboardNode.valid() && cv ) 21 | { 22 | osg::Vec3d translation, scale; 23 | osg::Quat rotation, so; 24 | cv->getModelViewMatrix()->decompose( translation, rotation, scale, so ); 25 | 26 | osg::Matrixd matrix( rotation.inverse() ); 27 | _billboardNode->setMatrix( matrix ); 28 | } 29 | traverse( node, nv ); 30 | } 31 | 32 | protected: 33 | osg::observer_ptr _billboardNode; 34 | }; 35 | 36 | int main( int argc, char** argv ) 37 | { 38 | osg::ref_ptr billboardNode = new osg::MatrixTransform; 39 | billboardNode->addChild( osgDB::readNodeFile("cessna.osg") ); 40 | 41 | osg::ref_ptr root = new osg::Group; 42 | root->addChild( billboardNode.get() ); 43 | root->addChild( osgDB::readNodeFile("lz.osg") ); 44 | root->addCullCallback( new BillboardCallback(billboardNode.get()) ); 45 | 46 | osgViewer::Viewer viewer; 47 | viewer.setSceneData( root.get() ); 48 | return viewer.run(); 49 | } 50 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_09/CgCallbacks: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 9 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH2_CGCALLBACKS 7 | #define H_COOKBOOK_CH2_CGCALLBACKS 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | class CgDrawCallback : public osg::Camera::DrawCallback 14 | { 15 | public: 16 | void addProfile( CGprofile profile ) { _profiles.push_back(profile); } 17 | void addCompiledProgram( CGprogram prog ) { _programs.push_back(prog); } 18 | 19 | protected: 20 | std::vector _profiles; 21 | std::vector _programs; 22 | }; 23 | 24 | class CgStartDrawCallback : public CgDrawCallback 25 | { 26 | public: 27 | CgStartDrawCallback(); 28 | 29 | virtual void operator()( osg::RenderInfo& renderInfo ) const; 30 | 31 | protected: 32 | mutable bool _initialized; 33 | }; 34 | 35 | class CgEndDrawCallback : public CgDrawCallback 36 | { 37 | public: 38 | virtual void operator()( osg::RenderInfo& renderInfo ) const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_09/CgCallbacks.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 9 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include "CgCallbacks" 7 | 8 | CgStartDrawCallback::CgStartDrawCallback() 9 | : _initialized(false) 10 | { 11 | } 12 | 13 | void CgStartDrawCallback::operator()( osg::RenderInfo& renderInfo ) const 14 | { 15 | if ( !_initialized ) 16 | { 17 | for ( unsigned int i=0; i<_programs.size(); ++i ) 18 | { 19 | cgGLLoadProgram( _programs[i] ); 20 | } 21 | _initialized = true; 22 | } 23 | 24 | for ( unsigned int i=0; i<_programs.size(); ++i ) 25 | { 26 | cgGLBindProgram( _programs[i] ); 27 | } 28 | 29 | for ( unsigned int i=0; i<_profiles.size(); ++i ) 30 | { 31 | cgGLEnableProfile( _profiles[i] ); 32 | } 33 | } 34 | 35 | void CgEndDrawCallback::operator()( osg::RenderInfo& renderInfo ) const 36 | { 37 | for ( unsigned int i=0; i<_profiles.size(); ++i ) 38 | { 39 | cgGLDisableProfile( _profiles[i] ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_10/Compass: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH2_COMPASS 7 | #define H_COOKBOOK_CH2_COMPASS 8 | 9 | #include 10 | #include 11 | 12 | class Compass : public osg::Camera 13 | { 14 | public: 15 | Compass(); 16 | Compass( const Compass& copy, osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY ); 17 | META_Node( osg, Compass ); 18 | 19 | /** Set the plate of the compass inside the camera projection range. */ 20 | void setPlate( osg::MatrixTransform* plate ) { _plateTransform = plate; } 21 | osg::MatrixTransform* getPlate() { return _plateTransform.get(); } 22 | const osg::MatrixTransform* getPlate() const { return _plateTransform.get(); } 23 | 24 | /** Set the needle of the compass inside the camera projection range. */ 25 | void setNeedle( osg::MatrixTransform* needle ) { _needleTransform = needle; } 26 | osg::MatrixTransform* getNeedle() { return _needleTransform.get(); } 27 | const osg::MatrixTransform* getNeedle() const { return _needleTransform.get(); } 28 | 29 | /** Set the main camera for the compass; otherwise there will be no effect. */ 30 | void setMainCamera( osg::Camera* camera ) { _mainCamera = camera; } 31 | osg::Camera* getMainCamera() { return _mainCamera.get(); } 32 | const osg::Camera* getMainCamera() const { return _mainCamera.get(); } 33 | 34 | virtual void traverse( osg::NodeVisitor& nv ); 35 | 36 | protected: 37 | virtual ~Compass(); 38 | 39 | osg::ref_ptr _plateTransform; 40 | osg::ref_ptr _needleTransform; 41 | osg::observer_ptr _mainCamera; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cookbook/chapter2/ch02_10/Compass.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 2 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include "Compass" 7 | 8 | Compass::Compass() 9 | { 10 | } 11 | 12 | Compass::Compass( const Compass& copy, osg::CopyOp copyop ) 13 | : osg::Camera(copy, copyop), 14 | _plateTransform(copy._plateTransform), 15 | _needleTransform(copy._needleTransform), 16 | _mainCamera(copy._mainCamera) 17 | { 18 | } 19 | 20 | Compass::~Compass() 21 | { 22 | } 23 | 24 | void Compass::traverse( osg::NodeVisitor& nv ) 25 | { 26 | if ( _mainCamera.valid() && nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR ) 27 | { 28 | osg::Matrix matrix = _mainCamera->getViewMatrix(); 29 | matrix.setTrans( osg::Vec3() ); 30 | 31 | osg::Vec3 northVec = osg::Z_AXIS * matrix; 32 | northVec.z() = 0.0f; 33 | northVec.normalize(); 34 | 35 | osg::Vec3 axis = osg::Y_AXIS ^ northVec; 36 | float angle = atan2(axis.length(), osg::Y_AXIS*northVec); 37 | axis.normalize(); 38 | 39 | if ( _plateTransform.valid() ) 40 | _plateTransform->setMatrix( osg::Matrix::rotate(angle, axis) ); 41 | } 42 | 43 | _plateTransform->accept( nv ); 44 | _needleTransform->accept( nv ); 45 | osg::Camera::traverse( nv ); 46 | } 47 | -------------------------------------------------------------------------------- /cookbook/chapter3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example 1: Creating a polygon with borderlines 2 | SET(EXAMPLE_NAME cookbook_03_01) 3 | SET(EXAMPLE_FILES ch03_01/draw_polygon.cpp) 4 | START_EXAMPLE() 5 | 6 | # Example 2: Extruding a 2D shape to 3D 7 | SET(EXAMPLE_NAME cookbook_03_02) 8 | SET(EXAMPLE_FILES ch03_02/extrusion.cpp) 9 | START_EXAMPLE() 10 | 11 | # Example 3: Drawing a NURBS surface 12 | FIND_PACKAGE(OpenGL) 13 | IF(OPENGL_FOUND AND OPENGL_GLU_FOUND) 14 | SET(EXAMPLE_NAME cookbook_03_03) 15 | SET(EXAMPLE_FILES ch03_03/main.cpp 16 | ch03_03/NurbsSurface.cpp 17 | ch03_03/NurbsSurface) 18 | SET(EXTERNAL_INCLUDE_DIR "${OPENGL_INCLUDE_DIR}") 19 | SET(EXTERNAL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) 20 | START_EXAMPLE() 21 | ENDIF(OPENGL_FOUND AND OPENGL_GLU_FOUND) 22 | 23 | # Example 4: Drawing a dynamic clock on the screen 24 | SET(EXAMPLE_NAME cookbook_03_04) 25 | SET(EXAMPLE_FILES ch03_04/clock_face.cpp) 26 | START_EXAMPLE() 27 | 28 | # Example 5: Drawing a ribbon following a model 29 | SET(EXAMPLE_NAME cookbook_03_05) 30 | SET(EXAMPLE_FILES ch03_05/dynamic_ribbon.cpp) 31 | START_EXAMPLE() 32 | 33 | # Example 6: Selecting and highlighting a model 34 | SET(EXAMPLE_NAME cookbook_03_06) 35 | SET(EXAMPLE_FILES ch03_06/select_model.cpp) 36 | START_EXAMPLE() 37 | 38 | # Example 7: Selecting a triangle face of the model 39 | SET(EXAMPLE_NAME cookbook_03_07) 40 | SET(EXAMPLE_FILES ch03_07/select_face.cpp) 41 | START_EXAMPLE() 42 | 43 | # Example 8: Selecting a point of the model 44 | SET(EXAMPLE_NAME cookbook_03_08) 45 | SET(EXAMPLE_FILES ch03_08/select_point.cpp) 46 | START_EXAMPLE() 47 | 48 | # Example 9: Using vertex displacement mapping in shaders 49 | SET(EXAMPLE_NAME cookbook_03_09) 50 | SET(EXAMPLE_FILES ch03_09/vertex_displacement.cpp) 51 | START_EXAMPLE() 52 | 53 | # Example 10: Using the draw instanced extension 54 | SET(EXAMPLE_NAME cookbook_03_10) 55 | SET(EXAMPLE_FILES ch03_10/draw_instanced.cpp) 56 | START_EXAMPLE() 57 | -------------------------------------------------------------------------------- /cookbook/chapter4/ch04_08/tracker_manipulator.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 4 Recipe 8 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "CommonFunctions" 15 | 16 | int main( int argc, char** argv ) 17 | { 18 | osg::Node* model = osgDB::readNodeFile("cessna.osg.0,0,90.rot"); 19 | if ( !model ) return 1; 20 | 21 | osg::ref_ptr trans = new osg::MatrixTransform; 22 | trans->addUpdateCallback( osgCookBook::createAnimationPathCallback(100.0f, 20.0) ); 23 | trans->addChild( model ); 24 | 25 | osg::ref_ptr terrain = new osg::MatrixTransform; 26 | terrain->addChild( osgDB::readNodeFile("lz.osg") ); 27 | terrain->setMatrix( osg::Matrix::translate(0.0f, 0.0f,-200.0f) ); 28 | 29 | osg::ref_ptr root = new osg::Group; 30 | root->addChild( trans.get() ); 31 | root->addChild( terrain.get() ); 32 | 33 | osg::ref_ptr nodeTracker = new osgGA::NodeTrackerManipulator; 34 | nodeTracker->setHomePosition( osg::Vec3(0, -10.0, 0), osg::Vec3(), osg::Z_AXIS ); 35 | nodeTracker->setTrackerMode( osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION ); 36 | nodeTracker->setRotationMode( osgGA::NodeTrackerManipulator::TRACKBALL ); 37 | nodeTracker->setTrackNode( model ); 38 | 39 | osg::ref_ptr keySwitch = new osgGA::KeySwitchMatrixManipulator; 40 | keySwitch->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator ); 41 | keySwitch->addMatrixManipulator( '2', "NodeTracker", nodeTracker.get() ); 42 | 43 | osgViewer::Viewer viewer; 44 | viewer.setCameraManipulator( keySwitch.get() ); 45 | viewer.setSceneData( root.get() ); 46 | return viewer.run(); 47 | } 48 | -------------------------------------------------------------------------------- /cookbook/chapter4/ch04_09/TwoDimManipulator: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 4 Recipe 9 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH4_TWODIMMANIPULATOR 7 | #define H_COOKBOOK_CH4_TWODIMMANIPULATOR 8 | 9 | #include 10 | 11 | class TwoDimManipulator : public osgGA::StandardManipulator 12 | { 13 | public: 14 | TwoDimManipulator(); 15 | 16 | virtual osg::Matrixd getMatrix() const; 17 | virtual osg::Matrixd getInverseMatrix() const; 18 | virtual void setByMatrix( const osg::Matrixd& matrix ); 19 | virtual void setByInverseMatrix( const osg::Matrixd& matrix ); 20 | 21 | virtual void setTransformation( const osg::Vec3d&, const osg::Quat& ) {} 22 | virtual void setTransformation( const osg::Vec3d&, const osg::Vec3d&, const osg::Vec3d& ) {} 23 | virtual void getTransformation( osg::Vec3d&, osg::Quat& ) const {} 24 | virtual void getTransformation( osg::Vec3d&, osg::Vec3d&, osg::Vec3d& ) const {} 25 | 26 | virtual void home( double ); 27 | virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ) 28 | { home(ea.getTime()); } 29 | 30 | protected: 31 | virtual ~TwoDimManipulator(); 32 | 33 | virtual bool performMovementLeftMouseButton( 34 | const double eventTimeDelta, const double dx, const double dy ); 35 | virtual bool performMovementRightMouseButton( 36 | const double eventTimeDelta, const double dx, const double dy ); 37 | 38 | osg::Vec3 _center; 39 | double _distance; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /cookbook/chapter4/ch04_09/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 4 Recipe 9 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "CommonFunctions" 12 | #include "TwoDimManipulator" 13 | 14 | int main( int argc, char** argv ) 15 | { 16 | osg::ref_ptr root = new osg::Group; 17 | root->addChild( osgDB::readNodeFile("lz.osg") ); 18 | 19 | osg::ref_ptr keySwitch = new osgGA::KeySwitchMatrixManipulator; 20 | keySwitch->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator ); 21 | keySwitch->addMatrixManipulator( '2', "TwoDim", new TwoDimManipulator ); 22 | 23 | const osg::BoundingSphere& bs = root->getBound(); 24 | keySwitch->setHomePosition( bs.center()+osg::Vec3(0.0f, 0.0f, bs.radius()), bs.center(), osg::Y_AXIS ); 25 | 26 | osgViewer::Viewer viewer; 27 | viewer.setCameraManipulator( keySwitch.get() ); 28 | viewer.setSceneData( root.get() ); 29 | return viewer.run(); 30 | } 31 | -------------------------------------------------------------------------------- /cookbook/chapter4/ch04_10/JoystickManipulator: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 4 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH4_JOYSTICKMANIPULATOR 7 | #define H_COOKBOOK_CH4_JOYSTICKMANIPULATOR 8 | 9 | #define DIRECTINPUT_VERSION 0x0800 10 | #include 11 | #include 12 | #include 13 | 14 | class TwoDimManipulator : public osgGA::StandardManipulator 15 | { 16 | public: 17 | TwoDimManipulator(); 18 | 19 | virtual osg::Matrixd getMatrix() const; 20 | virtual osg::Matrixd getInverseMatrix() const; 21 | virtual void setByMatrix( const osg::Matrixd& matrix ); 22 | virtual void setByInverseMatrix( const osg::Matrixd& matrix ); 23 | 24 | virtual void setTransformation( const osg::Vec3d&, const osg::Quat& ) {} 25 | virtual void setTransformation( const osg::Vec3d&, const osg::Vec3d&, const osg::Vec3d& ) {} 26 | virtual void getTransformation( osg::Vec3d&, osg::Quat& ) const {} 27 | virtual void getTransformation( osg::Vec3d&, osg::Vec3d&, osg::Vec3d& ) const {} 28 | 29 | virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ); 30 | virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ); 31 | 32 | virtual void home( double ); 33 | virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us ) 34 | { home(ea.getTime()); } 35 | 36 | protected: 37 | virtual ~TwoDimManipulator(); 38 | 39 | virtual bool performMovementLeftMouseButton( 40 | const double eventTimeDelta, const double dx, const double dy ); 41 | virtual bool performMovementRightMouseButton( 42 | const double eventTimeDelta, const double dx, const double dy ); 43 | 44 | osg::Vec3 _center; 45 | double _distance; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /cookbook/chapter4/ch04_10/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 4 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "CommonFunctions" 12 | #include "JoystickManipulator" 13 | 14 | int main( int argc, char** argv ) 15 | { 16 | osg::ref_ptr root = new osg::Group; 17 | root->addChild( osgDB::readNodeFile("lz.osg") ); 18 | 19 | osg::ref_ptr keySwitch = new osgGA::KeySwitchMatrixManipulator; 20 | keySwitch->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator ); 21 | keySwitch->addMatrixManipulator( '2', "TwoDim", new TwoDimManipulator ); 22 | 23 | const osg::BoundingSphere& bs = root->getBound(); 24 | keySwitch->setHomePosition( bs.center()+osg::Vec3(0.0f, 0.0f, bs.radius()), bs.center(), osg::Y_AXIS ); 25 | 26 | osgViewer::Viewer viewer; 27 | viewer.setCameraManipulator( keySwitch.get() ); 28 | viewer.setSceneData( root.get() ); 29 | return viewer.run(); 30 | } 31 | -------------------------------------------------------------------------------- /cookbook/chapter5/ch05_02/movie_texture.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 5 Recipe 2 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "CommonFunctions" 13 | 14 | int main( int argc, char** argv ) 15 | { 16 | osg::ArgumentParser arguments( &argc, argv ); 17 | 18 | osg::ref_ptr image; 19 | if ( arguments.argc()>1 ) 20 | image = osgDB::readImageFile( arguments[1] ); 21 | else 22 | { 23 | #ifdef WIN32 24 | image = osgDB::readImageFile( "0.ffmpeg", new osgDB::Options("format=vfwcap frame_rate=25") ); 25 | #else 26 | image = osgDB::readImageFile( "/dev/video0.ffmpeg" ); 27 | #endif 28 | } 29 | 30 | osg::ImageStream* imageStream = dynamic_cast( image.get() ); 31 | if ( imageStream ) imageStream->play(); 32 | 33 | osg::ref_ptr texture = new osg::Texture2D; 34 | texture->setImage( image.get() ); 35 | 36 | osg::ref_ptr quad = osg::createTexturedQuadGeometry( 37 | osg::Vec3(), osg::Vec3(1.0f, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, 1.0f) ); 38 | quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() ); 39 | 40 | osg::ref_ptr geode = new osg::Geode; 41 | geode->addDrawable( quad.get() ); 42 | 43 | osgViewer::Viewer viewer; 44 | viewer.setSceneData( geode.get() ); 45 | return viewer.run(); 46 | } 47 | -------------------------------------------------------------------------------- /cookbook/chapter5/ch05_08/Player: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 5 Recipe 8 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH5_PLAYER 7 | #define H_COOKBOOK_CH5_PLAYER 8 | 9 | #include 10 | #include 11 | #define RAND(min, max) ((min) + (float)rand()/(RAND_MAX) * ((max)-(min))) 12 | 13 | class Player : public osg::MatrixTransform 14 | { 15 | public: 16 | Player(); 17 | Player( float width, float height, const std::string& texfile ); 18 | 19 | float width() const { return _size[0]; } 20 | float height() const { return _size[1]; } 21 | 22 | void setSpeedVector( const osg::Vec3& sv ) { _speedVec = sv; } 23 | const osg::Vec3& getSpeedVector() const { return _speedVec; } 24 | 25 | enum PlayerType 26 | { 27 | INVALID_OBJ=0, PLAYER_OBJ, ENEMY_OBJ, 28 | PLAYER_BULLET_OBJ, ENEMY_BULLET_OBJ 29 | }; 30 | void setPlayerType( PlayerType t ) { _type = t; } 31 | PlayerType getPlayerType() const { return _type; } 32 | 33 | bool isBullet() const 34 | { return _type==PLAYER_BULLET_OBJ || _type==ENEMY_BULLET_OBJ; } 35 | 36 | bool update( const osgGA::GUIEventAdapter& ea, osg::Group* root ); 37 | bool intersectWith( Player* player ) const; 38 | 39 | protected: 40 | osg::Vec2 _size; 41 | osg::Vec3 _speedVec; 42 | PlayerType _type; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cookbook/chapter5/ch05_11/PhysXInterface: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 5 Recipe 12 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH5_PHYSXINTERFACE 7 | #define H_COOKBOOK_CH5_PHYSXINTERFACE 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | class PhysXInterface : public osg::Referenced 18 | { 19 | public: 20 | static PhysXInterface* instance(); 21 | 22 | void createWorld( const osg::Plane& plane, const osg::Vec3& gravity ); 23 | void createBox( int id, const osg::Vec3& dim, double mass ); 24 | void createSphere( int id, double radius, double mass ); 25 | 26 | void setVelocity( int id, const osg::Vec3& pos ); 27 | void setMatrix( int id, const osg::Matrix& matrix ); 28 | osg::Matrix getMatrix( int id ); 29 | 30 | void simulate( double step ); 31 | 32 | protected: 33 | PhysXInterface(); 34 | virtual ~PhysXInterface(); 35 | 36 | void createActor( int id, NxShapeDesc* shape, NxBodyDesc* body ); 37 | 38 | typedef std::map ActorMap; 39 | ActorMap _actors; 40 | NxPhysicsSDK* _physicsSDK; 41 | NxScene* _scene; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cookbook/chapter6/ch06_04/read_depth.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 6 Recipe 4 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "CommonFunctions" 12 | 13 | int main( int argc, char** argv ) 14 | { 15 | osg::ArgumentParser arguments( &argc, argv ); 16 | osg::ref_ptr scene = osgDB::readNodeFiles( arguments ); 17 | if ( !scene ) scene = osgDB::readNodeFile("cessna.osg"); 18 | 19 | osg::ref_ptr tex2D = new osg::Texture2D; 20 | tex2D->setTextureSize( 1024, 1024 ); 21 | tex2D->setInternalFormat( GL_DEPTH_COMPONENT24 ); 22 | tex2D->setSourceFormat( GL_DEPTH_COMPONENT ); 23 | tex2D->setSourceType( GL_FLOAT ); 24 | 25 | osg::ref_ptr rttCamera = osgCookBook::createRTTCamera(osg::Camera::DEPTH_BUFFER, tex2D.get()); 26 | rttCamera->addChild( scene.get() ); 27 | 28 | osg::ref_ptr hudCamera = osgCookBook::createHUDCamera(0.0, 1.0, 0.0, 1.0); 29 | hudCamera->addChild( osgCookBook::createScreenQuad(0.5f, 1.0f) ); 30 | hudCamera->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() ); 31 | 32 | osg::ref_ptr root = new osg::Group; 33 | root->addChild( rttCamera.get() ); 34 | root->addChild( hudCamera.get() ); 35 | root->addChild( scene.get() ); 36 | 37 | osgViewer::Viewer viewer; 38 | viewer.getCamera()->setComputeNearFarMode( osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR ); 39 | viewer.setSceneData( root.get() ); 40 | return viewer.run(); 41 | } 42 | -------------------------------------------------------------------------------- /cookbook/chapter6/ch06_07/SkyBox: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 6 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH6_SKYBOX 7 | #define H_COOKBOOK_CH6_SKYBOX 8 | 9 | #include 10 | #include 11 | 12 | class SkyBox : public osg::Transform 13 | { 14 | public: 15 | SkyBox(); 16 | 17 | SkyBox( const SkyBox& copy, osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY ) 18 | : osg::Transform(copy, copyop) {} 19 | 20 | META_Node( osg, SkyBox ); 21 | 22 | void setEnvironmentMap( unsigned int unit, osg::Image* posX, osg::Image* negX, 23 | osg::Image* posY, osg::Image* negY, osg::Image* posZ, osg::Image* negZ ); 24 | 25 | virtual bool computeLocalToWorldMatrix( osg::Matrix& matrix, osg::NodeVisitor* nv ) const; 26 | virtual bool computeWorldToLocalMatrix( osg::Matrix& matrix, osg::NodeVisitor* nv ) const; 27 | 28 | protected: 29 | virtual ~SkyBox() {} 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /cookbook/chapter6/ch06_07/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 6 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "CommonFunctions" 14 | #include "SkyBox" 15 | 16 | int main( int argc, char** argv ) 17 | { 18 | osg::ArgumentParser arguments( &argc, argv ); 19 | osg::ref_ptr scene = osgDB::readNodeFiles( arguments ); 20 | if ( !scene ) scene = osgDB::readNodeFile("lz.osg.90,0,0.rot"); 21 | 22 | osg::ref_ptr geode = new osg::Geode; 23 | geode->addDrawable( new osg::ShapeDrawable( 24 | new osg::Sphere(osg::Vec3(), scene->getBound().radius())) ); 25 | geode->setCullingActive( false ); 26 | 27 | osg::ref_ptr skybox = new SkyBox; 28 | skybox->getOrCreateStateSet()->setTextureAttributeAndModes( 0, new osg::TexGen ); 29 | skybox->setEnvironmentMap( 0, 30 | osgDB::readImageFile("Cubemap_snow/posx.jpg"), osgDB::readImageFile("Cubemap_snow/negx.jpg"), 31 | osgDB::readImageFile("Cubemap_snow/posy.jpg"), osgDB::readImageFile("Cubemap_snow/negy.jpg"), 32 | osgDB::readImageFile("Cubemap_snow/posz.jpg"), osgDB::readImageFile("Cubemap_snow/negz.jpg") ); 33 | skybox->addChild( geode.get() ); 34 | 35 | osg::ref_ptr root = new osg::Group; 36 | root->addChild( scene.get() ); 37 | root->addChild( skybox.get() ); 38 | 39 | osgViewer::Viewer viewer; 40 | viewer.setSceneData( root.get() ); 41 | return viewer.run(); 42 | } 43 | -------------------------------------------------------------------------------- /cookbook/chapter6/ch06_10/CgProgram: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 6 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH6_CGPROGRAM 7 | #define H_COOKBOOK_CH6_CGPROGRAM 8 | 9 | #include 10 | #include 11 | #include 12 | #define CGPROGRAM_ID 0x1000 13 | 14 | class CgProgram : public osg::StateAttribute 15 | { 16 | public: 17 | CgProgram() : _initialized(false) {} 18 | 19 | CgProgram( const CgProgram& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ) 20 | : osg::StateAttribute(copy, copyop), 21 | _profiles(copy._profiles), _programs(copy._programs), 22 | _initialized(copy._initialized) 23 | {} 24 | 25 | META_StateAttribute( osg, CgProgram, (osg::StateAttribute::Type)CGPROGRAM_ID ); 26 | 27 | void addProfile( CGprofile profile ); 28 | void addCompiledProgram( CGprogram prog ) { _programs.push_back(prog); } 29 | 30 | virtual int compare( const osg::StateAttribute& sa ) const; 31 | virtual void apply(osg::State& state) const; 32 | 33 | protected: 34 | virtual ~CgProgram() {} 35 | 36 | std::vector _profiles; 37 | std::vector _programs; 38 | mutable bool _initialized; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /cookbook/chapter6/ch06_10/CgProgram.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 6 Recipe 10 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include "CgProgram" 7 | 8 | static std::vector g_profiles; 9 | 10 | void CgProgram::addProfile( CGprofile profile ) 11 | { 12 | _profiles.push_back(profile); 13 | g_profiles.push_back(profile); 14 | } 15 | 16 | int CgProgram::compare( const osg::StateAttribute& sa ) const 17 | { 18 | COMPARE_StateAttribute_Types(CgProgram, sa) 19 | COMPARE_StateAttribute_Parameter(_profiles) 20 | COMPARE_StateAttribute_Parameter(_programs) 21 | COMPARE_StateAttribute_Parameter(_initialized) 22 | return 0; 23 | } 24 | 25 | void CgProgram::apply(osg::State& state) const 26 | { 27 | if ( !_profiles.size() ) 28 | { 29 | // Disable all profiles in the default attribute 30 | for ( unsigned int i=0; i 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "CommonFunctions" 15 | 16 | int main( int argc, char** argv ) 17 | { 18 | osg::ArgumentParser arguments( &argc, argv ); 19 | osg::ref_ptr root = osgDB::readNodeFiles(arguments); 20 | osg::Texture::getTextureObjectManager(0)->setMaxTexturePoolSize( 64000 ); 21 | 22 | osgViewer::Viewer viewer; 23 | osgDB::DatabasePager* pager = viewer.getDatabasePager(); 24 | pager->setDoPreCompile( true) ; 25 | pager->setTargetMaximumNumberOfPageLOD( 10 ); 26 | 27 | viewer.setSceneData( root.get() ); 28 | viewer.addEventHandler( new osgViewer::StatsHandler ); 29 | return viewer.run(); 30 | } 31 | -------------------------------------------------------------------------------- /cookbook/chapter8/ch08_05/MazeCullCallback: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 8 Recipe 5 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH8_MAZECULLCALLBACK 7 | #define H_COOKBOOK_CH8_MAZECULLCALLBACK 8 | 9 | #include 10 | 11 | typedef std::pair CellIndex; 12 | typedef std::map CellMap; 13 | extern CellMap g_mazeMap; 14 | 15 | class MazeCullCallback : public osg::NodeCallback 16 | { 17 | public: 18 | virtual void operator()( osg::Node* node, osg::NodeVisitor* nv ); 19 | 20 | bool getCellIndex( CellIndex& index, const osg::Vec3& pos ); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /cookbook/chapter8/ch08_05/MazeCullCallback.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 8 Recipe 5 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include "MazeCullCallback" 8 | 9 | void MazeCullCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) 10 | { 11 | osg::Vec3 eye = nv->getEyePoint(); 12 | osg::Vec3 center = node->getBound().center(); 13 | 14 | osg::Matrix l2w = osg::computeLocalToWorld( node->getParentalNodePaths()[0] ); 15 | eye = eye * l2w; center = center * l2w; 16 | 17 | CellIndex indexEye, indexNode; 18 | if ( getCellIndex(indexEye, eye) && getCellIndex(indexNode, center) ) 19 | { 20 | traverse( node, nv ); 21 | } 22 | // We don't traverse if the node is not visible in maze 23 | } 24 | 25 | bool MazeCullCallback::getCellIndex( CellIndex& index, const osg::Vec3& pos ) 26 | { 27 | index.first = int(pos[0] + 0.5f); 28 | index.second = int(pos[1] + 0.5f); 29 | CellMap::iterator itr = g_mazeMap.find(index); 30 | if ( itr!=g_mazeMap.end() && itr->second==0 ) 31 | return true; 32 | return false; 33 | } 34 | -------------------------------------------------------------------------------- /cookbook/chapter8/ch08_07/OctreeBuilder: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 8 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH8_OCTREEBUILDER 7 | #define H_COOKBOOK_CH8_OCTREEBUILDER 8 | 9 | #include 10 | #include 11 | 12 | class OctreeBuilder 13 | { 14 | public: 15 | OctreeBuilder() : _maxChildNumber(16), _maxTreeDepth(32), _maxLevel(0) {} 16 | int getMaxLevel() const { return _maxLevel; } 17 | 18 | void setMaxChildNumber( int max ) { _maxChildNumber = max; } 19 | int getMaxChildNumber() const { return _maxChildNumber; } 20 | 21 | void setMaxTreeDepth( int max ) { _maxTreeDepth = max; } 22 | int getMaxTreeDepth() const { return _maxTreeDepth; } 23 | 24 | typedef std::pair ElementInfo; 25 | osg::Group* build( int depth, const osg::BoundingBox& total, 26 | std::vector& elements ); 27 | 28 | protected: 29 | osg::LOD* createNewLevel( int level, const osg::Vec3& center, float radius ); 30 | osg::Node* createElement( const std::string& id, const osg::Vec3& center, float radius ); 31 | osg::Geode* createBoxForDebug( const osg::Vec3& max, const osg::Vec3& min ); 32 | 33 | int _maxChildNumber; 34 | int _maxTreeDepth; 35 | int _maxLevel; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /cookbook/chapter8/ch08_07/main.cpp: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 8 Recipe 7 3 | * Author: Wang Rui 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "CommonFunctions" 16 | #include "OctreeBuilder" 17 | 18 | class PrintNameVisitor : public osgUtil::PrintVisitor 19 | { 20 | public: 21 | PrintNameVisitor( std::ostream& out ) : osgUtil::PrintVisitor(out) {} 22 | 23 | void apply( osg::Node& node ) 24 | { 25 | if ( !node.getName().empty() ) 26 | { 27 | output() << node.getName() << std::endl; 28 | enter(); 29 | traverse( node ); 30 | leave(); 31 | } 32 | else osgUtil::PrintVisitor::apply(node); 33 | } 34 | }; 35 | 36 | int main( int argc, char** argv ) 37 | { 38 | osg::BoundingBox globalBound; 39 | std::vector globalElements; 40 | for ( unsigned int i=0; i<5000; ++i ) 41 | { 42 | osg::Vec3 pos = osgCookBook::randomVector( -500.0f, 500.0f ); 43 | float radius = osgCookBook::randomValue( 0.5f, 2.0f ); 44 | std::stringstream ss; ss << "Ball-" << i+1; 45 | 46 | osg::Vec3 min = pos - osg::Vec3(radius, radius, radius); 47 | osg::Vec3 max = pos + osg::Vec3(radius, radius, radius); 48 | osg::BoundingBox region(min, max); 49 | globalBound.expandBy( region ); 50 | globalElements.push_back( OctreeBuilder::ElementInfo(ss.str(), region) ); 51 | } 52 | 53 | OctreeBuilder octree; 54 | osg::ref_ptr root = octree.build( 0, globalBound, globalElements ); 55 | 56 | std::ofstream out("octree_output.txt"); 57 | PrintNameVisitor printer( out ); 58 | root->accept( printer ); 59 | 60 | osgViewer::Viewer viewer; 61 | viewer.setSceneData( root.get() ); 62 | viewer.addEventHandler( new osgViewer::StatsHandler ); 63 | return viewer.run(); 64 | } 65 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_04/CEGUIDrawable: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Chapter 9 Recipe 4 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_CH9_CEGUIDRAWABLE 7 | #define H_COOKBOOK_CH9_CEGUIDRAWABLE 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | class CEGUIDrawable : public osg::Drawable 14 | { 15 | public: 16 | CEGUIDrawable(); 17 | CEGUIDrawable( const CEGUIDrawable& copy,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ); 18 | META_Object( osg, CEGUIDrawable ); 19 | 20 | virtual void drawImplementation( osg::RenderInfo& renderInfo ) const; 21 | 22 | void initializeControls(); 23 | bool handleClose( const CEGUI::EventArgs& e ); 24 | 25 | protected: 26 | virtual ~CEGUIDrawable() {} 27 | 28 | mutable double _lastSimulationTime; 29 | mutable unsigned int _activeContextID; 30 | mutable bool _initialized; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-generated CMakeLists.txt for the osgWeb project 4 | # 5 | #\**********************************************************/ 6 | 7 | # Written to work with cmake 2.6 8 | cmake_minimum_required (VERSION 2.6) 9 | set (CMAKE_BACKWARDS_COMPATIBILITY 2.6) 10 | 11 | Project(${PLUGIN_NAME}) 12 | 13 | file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 14 | [^.]*.cpp 15 | [^.]*.h 16 | [^.]*.cmake 17 | ) 18 | 19 | include_directories(${PLUGIN_INCLUDE_DIRS}) 20 | 21 | # Generated files are stored in ${GENERATED} by the project configuration 22 | SET_SOURCE_FILES_PROPERTIES( 23 | ${GENERATED} 24 | PROPERTIES 25 | GENERATED 1 26 | ) 27 | 28 | SOURCE_GROUP(Generated FILES 29 | ${GENERATED} 30 | ) 31 | 32 | SET( SOURCES 33 | ${GENERAL} 34 | ${GENERATED} 35 | ) 36 | 37 | # This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef 38 | # depending on the platform 39 | 40 | find_path( OPENSCENEGRAPH_ROOT include/osg/Node PATHS $ENV{OSG_ROOT} ) 41 | include_directories( ${OPENSCENEGRAPH_ROOT}/include ) 42 | link_directories( ${Boost_LIBRARY_DIRS} ${OPENSCENEGRAPH_ROOT}/lib ) 43 | include_platform() 44 | target_link_libraries(${PROJECT_NAME} OpenThreads osg osgDB osgGA osgViewer) 45 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/Factory.cpp: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated Factory.cpp 4 | 5 | This file contains the auto-generated factory methods 6 | for the osgWeb project 7 | 8 | \**********************************************************/ 9 | 10 | #include "FactoryBase.h" 11 | #include "osgWeb.h" 12 | #include 13 | 14 | class PluginFactory : public FB::FactoryBase 15 | { 16 | public: 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// @fn FB::PluginCorePtr createPlugin(const std::string& mimetype) 19 | /// 20 | /// @brief Creates a plugin object matching the provided mimetype 21 | /// If mimetype is empty, returns the default plugin 22 | /////////////////////////////////////////////////////////////////////////////// 23 | FB::PluginCorePtr createPlugin(const std::string& mimetype) 24 | { 25 | return boost::make_shared(); 26 | } 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// @see FB::FactoryBase::globalPluginInitialize 30 | /////////////////////////////////////////////////////////////////////////////// 31 | void globalPluginInitialize() 32 | { 33 | osgWeb::StaticInitialize(); 34 | } 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | /// @see FB::FactoryBase::globalPluginDeinitialize 38 | /////////////////////////////////////////////////////////////////////////////// 39 | void globalPluginDeinitialize() 40 | { 41 | osgWeb::StaticDeinitialize(); 42 | } 43 | }; 44 | 45 | /////////////////////////////////////////////////////////////////////////////// 46 | /// @fn getFactoryInstance() 47 | /// 48 | /// @brief Returns the factory instance for this plugin module 49 | /////////////////////////////////////////////////////////////////////////////// 50 | FB::FactoryBasePtr getFactoryInstance() 51 | { 52 | static boost::shared_ptr factory = boost::make_shared(); 53 | return factory; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/Mac/bundle_template/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "${PLUGIN_NAME}.plugin"; 4 | NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}"; 5 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/Mac/bundle_template/Localized.r: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | resource 'STR#' (126) 4 | { { 5 | "${FBSTRING_LegalCopyright}", 6 | "${FBSTRING_ProductName}" 7 | } }; 8 | 9 | resource 'STR#' (127) 10 | { { 11 | "", 12 | } }; 13 | 14 | resource 'STR#' (128) 15 | { { 16 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT) 17 | "${CUR_MIMETYPE}", 18 | "${CUR_EXTENT}", 19 | @endforeach 20 | } }; 21 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/Mac/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Mac project definition file for the 3 | # osgWeb project 4 | #\**********************************************************/ 5 | 6 | # Mac template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in Mac/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | Mac/[^.]*.cpp 12 | Mac/[^.]*.h 13 | Mac/[^.]*.cmake 14 | ) 15 | 16 | # use this to add preprocessor definitions 17 | add_definitions( 18 | 19 | ) 20 | 21 | 22 | SOURCE_GROUP(Mac FILES ${PLATFORM}) 23 | 24 | set (SOURCES 25 | ${SOURCES} 26 | ${PLATFORM} 27 | ) 28 | 29 | set(PLIST "Mac/bundle_template/Info.plist") 30 | set(STRINGS "Mac/bundle_template/InfoPlist.strings") 31 | set(LOCALIZED "Mac/bundle_template/Localized.r") 32 | 33 | add_mac_plugin(${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES) 34 | 35 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 36 | target_link_libraries(${PROJECT_NAME} 37 | ${PLUGIN_INTERNAL_DEPS} 38 | ) 39 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/X11/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated X11 project definition file for the 3 | # osgWeb project 4 | #\**********************************************************/ 5 | 6 | # X11 template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in X11/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | X11/[^.]*.cpp 12 | X11/[^.]*.h 13 | X11/[^.]*.cmake 14 | ) 15 | 16 | SOURCE_GROUP(X11 FILES ${PLATFORM}) 17 | 18 | # use this to add preprocessor definitions 19 | add_definitions( 20 | ) 21 | 22 | set (SOURCES 23 | ${SOURCES} 24 | ${PLATFORM} 25 | ) 26 | 27 | add_x11_plugin(${PROJECT_NAME} SOURCES) 28 | 29 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 30 | target_link_libraries(${PROJECT_NAME} 31 | ${PLUGIN_INTERNAL_DEPS} 32 | ) 33 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_08/osgWebAPI.h: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated osgWebAPI.h 4 | 5 | \**********************************************************/ 6 | 7 | #include 8 | #include 9 | #include 10 | #include "JSAPIAuto.h" 11 | #include "BrowserHost.h" 12 | #include "osgWeb.h" 13 | 14 | #ifndef H_osgWebAPI 15 | #define H_osgWebAPI 16 | 17 | class osgWebAPI : public FB::JSAPIAuto 18 | { 19 | public: 20 | osgWebAPI(const osgWebPtr& plugin, const FB::BrowserHostPtr& host); 21 | virtual ~osgWebAPI(); 22 | 23 | osgWebPtr getPlugin(); 24 | 25 | // Read/Write property ${PROPERTY.ident} 26 | std::string get_testString(); 27 | void set_testString(const std::string& val); 28 | 29 | // Read-only property ${PROPERTY.ident} 30 | std::string get_version(); 31 | 32 | // Method echo 33 | FB::variant echo(const FB::variant& msg); 34 | 35 | // Event helpers 36 | FB_JSAPI_EVENT(fired, 3, (const FB::variant&, bool, int)); 37 | FB_JSAPI_EVENT(echo, 2, (const FB::variant&, const int)); 38 | FB_JSAPI_EVENT(notify, 0, ()); 39 | 40 | // Method test-event 41 | void testEvent(const FB::variant& s); 42 | 43 | private: 44 | osgWebWeakPtr m_plugin; 45 | FB::BrowserHostPtr m_host; 46 | 47 | std::string m_testString; 48 | }; 49 | 50 | #endif // H_osgWebAPI 51 | 52 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-generated CMakeLists.txt for the osgWeb project 4 | # 5 | #\**********************************************************/ 6 | 7 | # Written to work with cmake 2.6 8 | cmake_minimum_required (VERSION 2.6) 9 | set (CMAKE_BACKWARDS_COMPATIBILITY 2.6) 10 | 11 | Project(${PLUGIN_NAME}) 12 | 13 | file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 14 | [^.]*.cpp 15 | [^.]*.h 16 | [^.]*.cmake 17 | ) 18 | 19 | include_directories(${PLUGIN_INCLUDE_DIRS}) 20 | 21 | # Generated files are stored in ${GENERATED} by the project configuration 22 | SET_SOURCE_FILES_PROPERTIES( 23 | ${GENERATED} 24 | PROPERTIES 25 | GENERATED 1 26 | ) 27 | 28 | SOURCE_GROUP(Generated FILES 29 | ${GENERATED} 30 | ) 31 | 32 | SET( SOURCES 33 | ${GENERAL} 34 | ${GENERATED} 35 | ) 36 | 37 | # This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef 38 | # depending on the platform 39 | 40 | find_path( OPENSCENEGRAPH_ROOT include/osg/Node PATHS $ENV{OSG_ROOT} ) 41 | include_directories( ${OPENSCENEGRAPH_ROOT}/include ) 42 | link_directories( ${Boost_LIBRARY_DIRS} ${OPENSCENEGRAPH_ROOT}/lib ) 43 | include_platform() 44 | target_link_libraries(${PROJECT_NAME} OpenThreads osg osgDB osgGA osgViewer) 45 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/Factory.cpp: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated Factory.cpp 4 | 5 | This file contains the auto-generated factory methods 6 | for the osgWeb project 7 | 8 | \**********************************************************/ 9 | 10 | #include "FactoryBase.h" 11 | #include "osgWeb.h" 12 | #include 13 | 14 | class PluginFactory : public FB::FactoryBase 15 | { 16 | public: 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// @fn FB::PluginCorePtr createPlugin(const std::string& mimetype) 19 | /// 20 | /// @brief Creates a plugin object matching the provided mimetype 21 | /// If mimetype is empty, returns the default plugin 22 | /////////////////////////////////////////////////////////////////////////////// 23 | FB::PluginCorePtr createPlugin(const std::string& mimetype) 24 | { 25 | return boost::make_shared(); 26 | } 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// @see FB::FactoryBase::globalPluginInitialize 30 | /////////////////////////////////////////////////////////////////////////////// 31 | void globalPluginInitialize() 32 | { 33 | osgWeb::StaticInitialize(); 34 | } 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | /// @see FB::FactoryBase::globalPluginDeinitialize 38 | /////////////////////////////////////////////////////////////////////////////// 39 | void globalPluginDeinitialize() 40 | { 41 | osgWeb::StaticDeinitialize(); 42 | } 43 | }; 44 | 45 | /////////////////////////////////////////////////////////////////////////////// 46 | /// @fn getFactoryInstance() 47 | /// 48 | /// @brief Returns the factory instance for this plugin module 49 | /////////////////////////////////////////////////////////////////////////////// 50 | FB::FactoryBasePtr getFactoryInstance() 51 | { 52 | static boost::shared_ptr factory = boost::make_shared(); 53 | return factory; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/Mac/bundle_template/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "${PLUGIN_NAME}.plugin"; 4 | NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}"; 5 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/Mac/bundle_template/Localized.r: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | resource 'STR#' (126) 4 | { { 5 | "${FBSTRING_LegalCopyright}", 6 | "${FBSTRING_ProductName}" 7 | } }; 8 | 9 | resource 'STR#' (127) 10 | { { 11 | "", 12 | } }; 13 | 14 | resource 'STR#' (128) 15 | { { 16 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT) 17 | "${CUR_MIMETYPE}", 18 | "${CUR_EXTENT}", 19 | @endforeach 20 | } }; 21 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/Mac/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Mac project definition file for the 3 | # osgWeb project 4 | #\**********************************************************/ 5 | 6 | # Mac template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in Mac/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | Mac/[^.]*.cpp 12 | Mac/[^.]*.h 13 | Mac/[^.]*.cmake 14 | ) 15 | 16 | # use this to add preprocessor definitions 17 | add_definitions( 18 | 19 | ) 20 | 21 | 22 | SOURCE_GROUP(Mac FILES ${PLATFORM}) 23 | 24 | set (SOURCES 25 | ${SOURCES} 26 | ${PLATFORM} 27 | ) 28 | 29 | set(PLIST "Mac/bundle_template/Info.plist") 30 | set(STRINGS "Mac/bundle_template/InfoPlist.strings") 31 | set(LOCALIZED "Mac/bundle_template/Localized.r") 32 | 33 | add_mac_plugin(${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES) 34 | 35 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 36 | target_link_libraries(${PROJECT_NAME} 37 | ${PLUGIN_INTERNAL_DEPS} 38 | ) 39 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/X11/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated X11 project definition file for the 3 | # osgWeb project 4 | #\**********************************************************/ 5 | 6 | # X11 template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in X11/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | X11/[^.]*.cpp 12 | X11/[^.]*.h 13 | X11/[^.]*.cmake 14 | ) 15 | 16 | SOURCE_GROUP(X11 FILES ${PLATFORM}) 17 | 18 | # use this to add preprocessor definitions 19 | add_definitions( 20 | ) 21 | 22 | set (SOURCES 23 | ${SOURCES} 24 | ${PLATFORM} 25 | ) 26 | 27 | add_x11_plugin(${PROJECT_NAME} SOURCES) 28 | 29 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 30 | target_link_libraries(${PROJECT_NAME} 31 | ${PLUGIN_INTERNAL_DEPS} 32 | ) 33 | -------------------------------------------------------------------------------- /cookbook/chapter9/ch09_09/osgWebAPI.h: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated osgWebAPI.h 4 | 5 | \**********************************************************/ 6 | 7 | #include 8 | #include 9 | #include 10 | #include "JSAPIAuto.h" 11 | #include "BrowserHost.h" 12 | #include "osgWeb.h" 13 | 14 | #ifndef H_osgWebAPI 15 | #define H_osgWebAPI 16 | 17 | class osgWebAPI : public FB::JSAPIAuto 18 | { 19 | public: 20 | osgWebAPI(const osgWebPtr& plugin, const FB::BrowserHostPtr& host); 21 | virtual ~osgWebAPI(); 22 | 23 | osgWebPtr getPlugin(); 24 | 25 | // Read/Write property ${PROPERTY.ident} 26 | std::string get_testString(); 27 | void set_testString(const std::string& val); 28 | 29 | // Read-only property ${PROPERTY.ident} 30 | std::string get_version(); 31 | 32 | // Method echo 33 | FB::variant echo(const FB::variant& msg); 34 | 35 | // Event helpers 36 | FB_JSAPI_EVENT(fired, 3, (const FB::variant&, bool, int)); 37 | FB_JSAPI_EVENT(echo, 2, (const FB::variant&, const int)); 38 | FB_JSAPI_EVENT(notify, 0, ()); 39 | 40 | // Method test-event 41 | void testEvent(const FB::variant& s); 42 | 43 | private: 44 | osgWebWeakPtr m_plugin; 45 | FB::BrowserHostPtr m_host; 46 | 47 | std::string m_testString; 48 | }; 49 | 50 | #endif // H_osgWebAPI 51 | 52 | -------------------------------------------------------------------------------- /cookbook/common/CommonFunctions: -------------------------------------------------------------------------------- 1 | /* -*-c++-*- OpenSceneGraph Cookbook 2 | * Common functions 3 | * Author: Wang Rui 4 | */ 5 | 6 | #ifndef H_COOKBOOK_COMMONFUNCTIONS 7 | #define H_COOKBOOK_COMMONFUNCTIONS 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace osgCookBook 17 | { 18 | 19 | extern osg::AnimationPathCallback* createAnimationPathCallback( float radius, float time ); 20 | extern osg::Camera* createRTTCamera( osg::Camera::BufferComponent buffer, osg::Texture* tex, bool isAbsolute=false ); 21 | extern osg::Camera* createHUDCamera( double left, double right, double bottom, double top ); 22 | extern osg::Geode* createScreenQuad( float width, float height, float scale=1.0f ); 23 | extern osgText::Text* createText( const osg::Vec3& pos, const std::string& content, float size ); 24 | 25 | extern float randomValue( float min, float max ); 26 | extern osg::Vec3 randomVector( float min, float max ); 27 | extern osg::Matrix randomMatrix( float min, float max ); 28 | 29 | class PickHandler : public osgGA::GUIEventHandler 30 | { 31 | public: 32 | virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ); 33 | virtual void doUserOperations( osgUtil::LineSegmentIntersector::Intersection& result ) = 0; 34 | }; 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /cookbook/data/animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/animation.gif -------------------------------------------------------------------------------- /cookbook/data/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/bullet.png -------------------------------------------------------------------------------- /cookbook/data/compass_needle.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/compass_needle.PNG -------------------------------------------------------------------------------- /cookbook/data/compass_plate.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/compass_plate.PNG -------------------------------------------------------------------------------- /cookbook/data/enemy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/enemy.png -------------------------------------------------------------------------------- /cookbook/data/files.txt: -------------------------------------------------------------------------------- 1 | cessna.osg 0 0 40 2 | cow.osg 40 0 0 3 | cessna.osg 0 40 40 4 | dumptruck.osg 20 40 0 5 | cessna.osg 40 0 40 6 | cow.osg 0 20 0 7 | cessna.osg 40 40 40 -------------------------------------------------------------------------------- /cookbook/data/maze.txt: -------------------------------------------------------------------------------- 1 | 1 1 1 1 1 1 0 1 2 | 1 0 0 0 0 0 0 1 3 | 1 0 1 0 1 1 0 1 4 | 1 0 1 0 1 0 0 1 5 | 1 0 1 0 1 1 1 1 6 | 1 1 1 0 0 0 0 1 7 | 0 0 0 0 1 0 1 1 8 | 1 1 1 1 1 1 1 1 -------------------------------------------------------------------------------- /cookbook/data/noise_tex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/noise_tex.jpg -------------------------------------------------------------------------------- /cookbook/data/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/player.png -------------------------------------------------------------------------------- /cookbook/data/water_DUDV.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/water_DUDV.jpg -------------------------------------------------------------------------------- /cookbook/data/water_NM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgRecipes/c93b8a54b238f40184c889b990d37603f887ba25/cookbook/data/water_NM.jpg -------------------------------------------------------------------------------- /effectcompositor/Description.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 |