├── .gitignore ├── 01.EmbedResource ├── CMakeLists.txt ├── README.md ├── android │ ├── .hgignore │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── format.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── format.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex01.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── kornerr.xcuserdatad │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── format.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Application.h │ ├── Example.h │ ├── Features.txt │ ├── core.h │ ├── format.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── render.h │ ├── rendering.h │ ├── resource.h │ └── scene.h ├── 02.TextureImage ├── CMakeLists.txt ├── README.md ├── android │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── format.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── core.h │ │ ├── format.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex02.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── format.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Features.txt │ ├── format.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── render.h │ ├── resource.h │ └── scene.h ├── 03.HTTPClient ├── CMakeLists.txt ├── README.md ├── android │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── core.h │ │ │ ├── format.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── network.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── core.h │ │ ├── format.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── network.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex03.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── core.h │ │ ├── format.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── network.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Features.txt │ ├── core.h │ ├── format.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── network.h │ ├── render.h │ ├── resource.h │ └── scene.h ├── 04.RemoteDebugging ├── CMakeLists.txt ├── README.md ├── android │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── core.h │ │ │ ├── debug.h │ │ │ ├── format.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── network.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── core.h │ │ ├── debug.h │ │ ├── format.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── network.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex04.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── core.h │ │ ├── debug.h │ │ ├── format.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── network.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Features.txt │ ├── core.h │ ├── debug.h │ ├── format.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── network.h │ ├── render.h │ ├── resource.h │ └── scene.h ├── 05.NodeSelection ├── CMakeLists.txt ├── README.md ├── android │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── core.h │ │ │ ├── format.h │ │ │ ├── input.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── core.h │ │ ├── format.h │ │ ├── input.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex05.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── core.h │ │ ├── format.h │ │ ├── input.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Features.txt │ ├── core.h │ ├── format.h │ ├── input.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── render.h │ ├── resource.h │ └── scene.h ├── 06.CommandSequence ├── CMakeLists.txt ├── README.md ├── android │ ├── android.iml │ ├── app │ │ ├── CMakeLists.txt │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── cpp │ │ │ ├── Features.txt │ │ │ ├── core.h │ │ │ ├── format.h │ │ │ ├── input.h │ │ │ ├── library.cpp │ │ │ ├── log.h │ │ │ ├── main.h │ │ │ ├── render.h │ │ │ ├── resource.h │ │ │ └── scene.h │ │ │ ├── java │ │ │ ├── Features.txt │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── desktop │ ├── CMakeLists.txt │ └── src │ │ ├── Features.txt │ │ ├── core.h │ │ ├── format.h │ │ ├── input.h │ │ ├── log.h │ │ ├── main.cpp │ │ ├── main.h │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── ios │ ├── ex06.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ └── src │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Features.txt │ │ ├── Info.plist │ │ ├── core.h │ │ ├── format.h │ │ ├── input.h │ │ ├── ios.h │ │ ├── ios.mm │ │ ├── library.cpp │ │ ├── library.h │ │ ├── library.mm │ │ ├── log.h │ │ ├── main.h │ │ ├── main.m │ │ ├── render.h │ │ ├── resource.h │ │ └── scene.h ├── shot.png └── web │ ├── CMakeLists.txt │ └── src │ ├── Features.txt │ ├── core.h │ ├── format.h │ ├── input.h │ ├── log.h │ ├── main.cpp │ ├── main.h │ ├── render.h │ ├── resource.h │ └── scene.h ├── README.md ├── data ├── box.osgt ├── box.osgt.h ├── digit.png ├── digit.png.h ├── ppl.frag ├── ppl.frag.h ├── ppl.vert └── ppl.vert.h ├── features ├── android │ ├── EGLview.java │ ├── Ex01.java │ ├── Ex02.java │ ├── Ex03.java │ ├── Ex04.java │ ├── Ex05.java │ ├── Ex06.java │ ├── HTTPClientProcessor.java │ ├── HTTPRequest.java │ ├── HTTPRequestDelegate.java │ ├── MainActivity+HTTPClientProcessor.java │ ├── MainActivity+Input.java │ ├── MainActivity+library+frame.java │ ├── MainActivity+library+init.java │ ├── MainActivity.java │ ├── RendererDelegate.java │ ├── library+frame.java │ ├── library+handleMousePress.java │ ├── library+httpClient.java │ ├── library+init.java │ ├── library.java │ └── src │ │ └── MainActivity.java ├── core │ ├── CORE_REPORTER_LOG.cpp │ ├── CORE_SEQUENCE_ACTION.cpp │ ├── CORE_SEQUENCE_LOG.cpp │ ├── Reporter.cpp │ ├── Sequence.cpp │ └── src │ │ └── core.h ├── debug │ ├── DEBUG_DEBUGGER_LOG.cpp │ ├── DEBUG_PAGE_LOG.cpp │ ├── Debugger+page.cpp │ ├── Debugger+process.cpp │ ├── Debugger+processJSON.cpp │ ├── Debugger.cpp │ ├── Page+item.cpp │ ├── Page+setDesc.cpp │ ├── Page.cpp │ ├── PageDesc.cpp │ ├── debuggerToJSON.cpp │ ├── jsonToPageDesc.cpp │ ├── pageToJSON.cpp │ └── src │ │ └── debug.h ├── format │ ├── commandLineArgumentsToParameters.cpp │ ├── printfString.cpp │ ├── splitString.cpp │ ├── src │ │ └── format.h │ ├── stringStartsWith.cpp │ ├── trimmedString.cpp │ └── urlQueryToParameters.cpp ├── input │ ├── Mouse.cpp │ ├── MouseButtons.cpp │ ├── OSGCPE_INPUT_MOUSE_LOG.cpp │ └── src │ │ └── input.h ├── ios │ ├── AppDelegate+HTTPClientProcessor-ios.mm │ ├── AppDelegate+RenderVC.mm │ ├── AppDelegate.mm │ ├── HTTPClientProcessor-ios.mm │ ├── RenderVC+FrameReporting.mm │ ├── RenderVC.mm │ └── src │ │ ├── ios.h │ │ └── ios.mm ├── log │ ├── Logger.cpp │ ├── log-android.cpp │ ├── log-default.cpp │ ├── logLevelToString.cpp │ ├── logprintf.cpp │ └── src │ │ └── log.h ├── main │ ├── Application+CameraManipulator.cpp │ ├── Application+Debugging.cpp │ ├── Application+HTTPClient.cpp │ ├── Application+HTTPClientProcessor.cpp │ ├── Application+Logging.cpp │ ├── Application+Mouse.cpp │ ├── Application+Rendering.cpp │ ├── Application+WindowResizing-web.cpp │ ├── Application+camera.cpp │ ├── Application+frame+Reporting.cpp │ ├── Application+frame.cpp │ ├── Application+handleEvent-web.cpp │ ├── Application+handleMousePress-android.cpp │ ├── Application+run.cpp │ ├── Application+setupWindow-desktop.cpp │ ├── Application+setupWindow-embedded.cpp │ ├── Application+setupWindow-ios.cpp │ ├── Application+setupWindow-web.cpp │ ├── Application.cpp │ ├── Example+01.cpp │ ├── Example+02.cpp │ ├── Example+03.cpp │ ├── Example+04.cpp │ ├── Example+05.cpp │ ├── Example+06.cpp │ ├── Example+07.cpp │ ├── Example+BoxRotation.cpp │ ├── Example+BoxScene.cpp │ ├── Example+BoxSelection.cpp │ ├── Example+DebugCamera.cpp │ ├── Example+HTTPSGetPost.cpp │ ├── Example+SequenceTest.cpp │ ├── Example+SingleColorScene.cpp │ ├── Example+StaticPluginOSG.cpp │ ├── Example+StaticPluginPNG.cpp │ ├── Example+TextureImageScene.cpp │ ├── Example+VBO.cpp │ ├── Example.cpp │ ├── MAIN_APPLICATION_LOG.cpp │ ├── MAIN_EXAMPLE_LOG.cpp │ ├── library+Ex01+JNI-android.cpp │ ├── library+Ex02+JNI-android.cpp │ ├── library+Ex03+JNI-android.cpp │ ├── library+Ex04+JNI-android.cpp │ ├── library+Ex05+JNI-android.cpp │ ├── library+Ex06+JNI-android.cpp │ ├── library+frame-android.cpp │ ├── library+frame-ios.cpp │ ├── library+handleMousePress-android.cpp │ ├── library+httpClient-android.cpp │ ├── library+httpClient-ios.cpp │ ├── library+init-android.cpp │ ├── library+init-ios.cpp │ ├── library+jniStrings-android.cpp │ ├── library-android.cpp │ ├── library-ios.cpp │ ├── main+Arguments-desktop.cpp │ ├── main+Arguments-web.cpp │ ├── main+Input-web.cpp │ ├── main+WindowResizing-web.cpp │ ├── main-desktop.cpp │ ├── main-web.cpp │ └── src │ │ ├── library.cpp │ │ ├── library.h │ │ ├── main.cpp │ │ └── main.h ├── network │ ├── HTTPClient.cpp │ ├── HTTPClientFetch.cpp │ ├── HTTPClientProcessor.cpp │ ├── HTTPRequest.cpp │ ├── HTTPRequestProcessorFetch.cpp │ ├── HTTPRequestProcessorMongoose.cpp │ ├── fetch.cpp │ ├── mongoose.cpp │ └── src │ │ └── network.h ├── render │ ├── VBOSetupVisitor.cpp │ ├── createGraphicsContext-desktop.cpp │ ├── createGraphicsContext-ios.cpp │ ├── createShaderProgram.cpp │ ├── setupCamera.cpp │ └── src │ │ └── render.h ├── resource │ ├── Pool.cpp │ ├── RESOURCE_LOG.cpp │ ├── RESOURCE_POOL_LOG.cpp │ ├── Resource.cpp │ ├── ResourceStreamBuffer.cpp │ ├── createTexture.cpp │ ├── extension.cpp │ ├── node.cpp │ ├── setTextureImage.cpp │ ├── src │ │ └── resource.h │ ├── string.cpp │ └── stringToResourceContents.cpp └── scene │ ├── LinearInterpolator.cpp │ ├── OSGCPE_SCENE_LINEAR_INTERPOLATOR_LOG.cpp │ ├── PrintGraphVisitor.cpp │ ├── createBox.cpp │ ├── createShape.cpp │ ├── createSphere.cpp │ ├── degreesToQuaternion.cpp │ ├── nodeAtPosition.cpp │ ├── paintScene.cpp │ ├── quaternionToDegrees.cpp │ ├── setSimplePosition.cpp │ ├── setSimpleRotation.cpp │ ├── simplePosition.cpp │ ├── simpleRotation.cpp │ ├── src │ └── scene.h │ └── textureImageScene.cpp ├── generate ├── libs ├── OpenSceneGraph │ ├── CMakeLists.txt │ ├── include │ │ ├── android │ │ │ ├── OpenThreads │ │ │ │ ├── Config │ │ │ │ └── Version │ │ │ └── osg │ │ │ │ ├── Config │ │ │ │ ├── GL │ │ │ │ └── Version │ │ ├── ios │ │ │ ├── OpenThreads │ │ │ │ ├── Config │ │ │ │ └── Version │ │ │ ├── gen │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── gen.cpp │ │ │ └── osg │ │ │ │ ├── Config │ │ │ │ ├── GL │ │ │ │ └── Version │ │ ├── linux │ │ │ ├── OpenThreads │ │ │ │ ├── Config │ │ │ │ └── Version │ │ │ └── osg │ │ │ │ ├── Config │ │ │ │ ├── GL │ │ │ │ └── Version │ │ ├── macos │ │ │ ├── OpenThreads │ │ │ │ ├── Config │ │ │ │ └── Version │ │ │ └── osg │ │ │ │ ├── Config │ │ │ │ ├── GL │ │ │ │ └── Version │ │ └── web │ │ │ ├── OpenThreads │ │ │ ├── Config │ │ │ └── Version │ │ │ ├── gen │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ │ └── osg │ │ │ ├── Config │ │ │ ├── GL │ │ │ └── Version │ ├── src-ios │ │ ├── OpenThreads.mm │ │ ├── osg-01.mm │ │ ├── osg-02.mm │ │ ├── osg-03.mm │ │ ├── osgDB.mm │ │ ├── osgGA.mm │ │ ├── osgUtil.mm │ │ ├── osgViewer.mm │ │ ├── osgdb_imageio.mm │ │ ├── osgdb_osg.mm │ │ ├── osgdb_serializers_osg-Drawable.mm │ │ ├── osgdb_serializers_osg-Geode.mm │ │ ├── osgdb_serializers_osg-Geometry.mm │ │ ├── osgdb_serializers_osg-Group.mm │ │ ├── osgdb_serializers_osg-LibraryWrapper.mm │ │ ├── osgdb_serializers_osg-MatrixTransform.mm │ │ ├── osgdb_serializers_osg-Node.mm │ │ ├── osgdb_serializers_osg-Object.mm │ │ └── osgdb_serializers_osg-Transform.mm │ └── src │ │ ├── OpenThreads.cpp │ │ ├── osg-01.cpp │ │ ├── osg-02.cpp │ │ ├── osg-03.cpp │ │ ├── osgDB.cpp │ │ ├── osgDB.mm │ │ ├── osgGA.cpp │ │ ├── osgUtil.cpp │ │ ├── osgViewer-linux.cpp │ │ ├── osgViewer-macos.mm │ │ ├── osgViewer.cpp │ │ ├── osgdb_imageio.cpp │ │ ├── osgdb_osg.cpp │ │ ├── osgdb_png.cpp │ │ ├── osgdb_serializers_osg-Drawable.cpp │ │ ├── osgdb_serializers_osg-Geode.cpp │ │ ├── osgdb_serializers_osg-Geometry.cpp │ │ ├── osgdb_serializers_osg-Group.cpp │ │ ├── osgdb_serializers_osg-LibraryWrapper.cpp │ │ ├── osgdb_serializers_osg-MatrixTransform.cpp │ │ ├── osgdb_serializers_osg-Node.cpp │ │ ├── osgdb_serializers_osg-Object.cpp │ │ └── osgdb_serializers_osg-Transform.cpp ├── json-android │ ├── CMakeLists.txt │ └── include │ │ └── nlohmann │ │ └── json.hpp ├── libpng-android │ ├── CMakeLists.txt │ └── src │ │ └── libpng.cpp └── mongoose │ ├── CMakeLists.txt │ └── mongoose.cpp ├── readme ├── shot-android.png ├── shot-desktop.png ├── shot-ios.png └── shot-web.png └── tools ├── create-serializers ├── emscripten-arguments ├── emscripten-fullpage └── patch-openscenegraph /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | # Mac. 3 | .DS_Store 4 | # Xcode. 5 | *.xcuserdatad 6 | IDEWorkspaceChecks.plist 7 | # Android Studio. 8 | build 9 | .gradle 10 | .idea 11 | .externalNativeBuild 12 | local.properties 13 | # Ignore NodeJS files. 14 | package-lock.json 15 | 16 | # Ignore VIM temporary files. 17 | *.swp 18 | -------------------------------------------------------------------------------- /01.EmbedResource/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX01_EMBED_RESOURCE) 10 | SET(EXAMPLE_BINARY_NAME "ex01-embed-resource") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /01.EmbedResource/android/.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | # Mac. 3 | .DS_Store 4 | 5 | # Android. 6 | build 7 | .gradle 8 | .idea 9 | .externalNativeBuild 10 | local.properties 11 | 12 | -------------------------------------------------------------------------------- /01.EmbedResource/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | 8 | # Reference sources. 9 | INCLUDE_DIRECTORIES(src/main/cpp) 10 | # Create native library. 11 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 12 | 13 | FIND_LIBRARY(log-lib log) 14 | 15 | # Link native library with libraries. 16 | TARGET_LINK_LIBRARIES( 17 | library 18 | ${log-lib} 19 | ${OSGCPE_LINK_LIBS} 20 | ) 21 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/cpp/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Rendering 5 | Application+frame 6 | Application+setupWindow-embedded 7 | 8 | MAIN_EXAMPLE_LOG 9 | Example 10 | Example+01 11 | Example+BoxScene 12 | Example+SingleColorScene 13 | Example+StaticPluginOSG 14 | Example+VBO 15 | 16 | library-android 17 | library+init-android 18 | library+frame-android 19 | library+Ex01+JNI-android 20 | 21 | # log 22 | Logger 23 | log-android 24 | logLevelToString 25 | logprintf 26 | 27 | # format 28 | printfString 29 | 30 | # resource 31 | RESOURCE_LOG 32 | Resource 33 | ResourceStreamBuffer 34 | extension 35 | node 36 | 37 | # render 38 | VBOSetupVisitor 39 | createShaderProgram 40 | 41 | # scene 42 | paintScene 43 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex01 2 | EGLview 3 | RendererDelegate 4 | MainActivity 5 | MainActivity+library+init 6 | MainActivity+library+frame 7 | library 8 | library+init 9 | library+frame 10 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex01 3 | 4 | -------------------------------------------------------------------------------- /01.EmbedResource/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /01.EmbedResource/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /01.EmbedResource/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /01.EmbedResource/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /01.EmbedResource/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /01.EmbedResource/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /01.EmbedResource/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Reference sources. 9 | INCLUDE_DIRECTORIES(src) 10 | # Create executable. 11 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 12 | 13 | # Link executable with libraries. 14 | TARGET_LINK_LIBRARIES( 15 | ${EXAMPLE_BINARY_NAME} 16 | ${OSGCPE_LINK_LIBS} 17 | ) 18 | -------------------------------------------------------------------------------- /01.EmbedResource/desktop/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Rendering 5 | Application+frame 6 | Application+run 7 | Application+setupWindow-desktop 8 | 9 | MAIN_EXAMPLE_LOG 10 | Example 11 | Example+01 12 | Example+BoxScene 13 | Example+SingleColorScene 14 | Example+StaticPluginOSG 15 | 16 | main-desktop 17 | 18 | # log 19 | Logger 20 | log-default 21 | logLevelToString 22 | logprintf 23 | 24 | # format 25 | printfString 26 | 27 | # resource 28 | RESOURCE_LOG 29 | Resource 30 | ResourceStreamBuffer 31 | extension 32 | node 33 | 34 | # render 35 | createGraphicsContext-desktop 36 | createShaderProgram 37 | setupCamera 38 | 39 | # scene 40 | paintScene 41 | -------------------------------------------------------------------------------- /01.EmbedResource/ios/ex01.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /01.EmbedResource/ios/ex01.xcodeproj/xcuserdata/kornerr.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ex01.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | mjin-player.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /01.EmbedResource/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /01.EmbedResource/ios/src/Features.txt: -------------------------------------------------------------------------------- 1 | # ios 2 | AppDelegate 3 | AppDelegate+RenderVC 4 | RenderVC 5 | RenderVC+FrameReporting 6 | 7 | # main 8 | Application 9 | Application+Logging 10 | Application+Rendering 11 | Application+frame 12 | Application+setupWindow-ios 13 | 14 | MAIN_EXAMPLE_LOG 15 | Example 16 | Example+01 17 | Example+BoxScene 18 | Example+SingleColorScene 19 | Example+StaticPluginOSG 20 | Example+VBO 21 | 22 | library-ios 23 | library+init-ios 24 | library+frame-ios 25 | 26 | # log 27 | Logger 28 | log-default 29 | logLevelToString 30 | logprintf 31 | 32 | # format 33 | printfString 34 | 35 | # resource 36 | RESOURCE_LOG 37 | Resource 38 | ResourceStreamBuffer 39 | extension 40 | node 41 | 42 | # render 43 | VBOSetupVisitor 44 | createGraphicsContext-ios 45 | createShaderProgram 46 | setupCamera 47 | 48 | # scene 49 | paintScene 50 | -------------------------------------------------------------------------------- /01.EmbedResource/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /01.EmbedResource/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/01.EmbedResource/shot.png -------------------------------------------------------------------------------- /01.EmbedResource/web/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+Logging 5 | Application+Rendering 6 | Application+frame 7 | Application+setupWindow-embedded 8 | Application+setupWindow-web 9 | 10 | MAIN_EXAMPLE_LOG 11 | Example 12 | Example+01 13 | Example+BoxScene 14 | Example+SingleColorScene 15 | Example+StaticPluginOSG 16 | Example+VBO 17 | 18 | main-web 19 | 20 | # log 21 | Logger 22 | log-default 23 | logLevelToString 24 | logprintf 25 | 26 | # format 27 | printfString 28 | 29 | # resource 30 | RESOURCE_LOG 31 | Resource 32 | ResourceStreamBuffer 33 | extension 34 | node 35 | 36 | # render 37 | VBOSetupVisitor 38 | createShaderProgram 39 | setupCamera 40 | 41 | # scene 42 | paintScene 43 | -------------------------------------------------------------------------------- /02.TextureImage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX02_TEXTURE_IMAGE) 10 | SET(EXAMPLE_BINARY_NAME "ex02-texture-image") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /02.TextureImage/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | # Include lipng-android CMakeLists.txt. 8 | INCLUDE(${OSGCPE_DIR}/libs/libpng-android/CMakeLists.txt) 9 | 10 | # Reference sources. 11 | INCLUDE_DIRECTORIES(src/main/cpp) 12 | # Create native library. 13 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 14 | 15 | FIND_LIBRARY(log-lib log) 16 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 17 | 18 | # Link native library with libraries. 19 | TARGET_LINK_LIBRARIES( 20 | library 21 | ${log-lib} 22 | ${OSGCPE_LINK_LIBS} 23 | ${IMAGE_LINK_LIBS} 24 | ) 25 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/cpp/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Rendering 5 | Application+frame 6 | Application+setupWindow-embedded 7 | 8 | MAIN_EXAMPLE_LOG 9 | Example 10 | Example+02 11 | Example+BoxScene 12 | Example+StaticPluginOSG 13 | Example+StaticPluginPNG 14 | Example+TextureImageScene 15 | Example+VBO 16 | 17 | library+Ex02+JNI-android 18 | 19 | library-android 20 | library+init-android 21 | library+frame-android 22 | 23 | # log 24 | Logger 25 | log-android 26 | logLevelToString 27 | logprintf 28 | 29 | # format 30 | printfString 31 | 32 | # resource 33 | RESOURCE_LOG 34 | Resource 35 | ResourceStreamBuffer 36 | createTexture 37 | extension 38 | node 39 | setTextureImage 40 | string 41 | 42 | # render 43 | VBOSetupVisitor 44 | createShaderProgram 45 | 46 | # scene 47 | textureImageScene 48 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex02 2 | EGLview 3 | RendererDelegate 4 | MainActivity 5 | MainActivity+library+init 6 | MainActivity+library+frame 7 | library 8 | library+init 9 | library+frame 10 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex02 3 | 4 | -------------------------------------------------------------------------------- /02.TextureImage/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /02.TextureImage/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /02.TextureImage/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /02.TextureImage/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /02.TextureImage/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /02.TextureImage/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /02.TextureImage/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Reference sources. 9 | INCLUDE_DIRECTORIES(src) 10 | # Create executable. 11 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 12 | 13 | # Use ImageIO for macOS. 14 | IF (${OSG_PLATFORM} STREQUAL "macos") 15 | SET(IMAGE_LINK_LIBS "osgdb_imageio") 16 | # Use libpng for Linux and Windows. 17 | ELSE () 18 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 19 | ENDIF () 20 | 21 | # Link executable with libraries. 22 | TARGET_LINK_LIBRARIES( 23 | ${EXAMPLE_BINARY_NAME} 24 | ${OSGCPE_LINK_LIBS} 25 | ${IMAGE_LINK_LIBS} 26 | ) 27 | -------------------------------------------------------------------------------- /02.TextureImage/desktop/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Rendering 5 | Application+frame 6 | Application+run 7 | Application+setupWindow-desktop 8 | 9 | MAIN_EXAMPLE_LOG 10 | Example 11 | Example+02 12 | Example+BoxScene 13 | Example+StaticPluginOSG 14 | Example+StaticPluginPNG 15 | Example+TextureImageScene 16 | 17 | main-desktop 18 | 19 | # log 20 | Logger 21 | log-default 22 | logLevelToString 23 | logprintf 24 | 25 | # format 26 | printfString 27 | 28 | # resource 29 | RESOURCE_LOG 30 | Resource 31 | ResourceStreamBuffer 32 | createTexture 33 | extension 34 | node 35 | setTextureImage 36 | string 37 | 38 | # render 39 | createGraphicsContext-desktop 40 | createShaderProgram 41 | setupCamera 42 | 43 | # scene 44 | textureImageScene 45 | -------------------------------------------------------------------------------- /02.TextureImage/ios/ex02.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /02.TextureImage/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /02.TextureImage/ios/src/Features.txt: -------------------------------------------------------------------------------- 1 | # ios 2 | AppDelegate 3 | AppDelegate+RenderVC 4 | RenderVC 5 | RenderVC+FrameReporting 6 | 7 | # main 8 | Application 9 | Application+Logging 10 | Application+Rendering 11 | Application+frame 12 | Application+setupWindow-ios 13 | 14 | MAIN_EXAMPLE_LOG 15 | Example 16 | Example+02 17 | Example+BoxScene 18 | Example+StaticPluginOSG 19 | Example+StaticPluginPNG 20 | Example+TextureImageScene 21 | Example+VBO 22 | 23 | library-ios 24 | library+init-ios 25 | library+frame-ios 26 | 27 | # log 28 | Logger 29 | log-default 30 | logLevelToString 31 | logprintf 32 | 33 | # format 34 | printfString 35 | 36 | # resource 37 | RESOURCE_LOG 38 | Resource 39 | ResourceStreamBuffer 40 | createTexture 41 | extension 42 | node 43 | setTextureImage 44 | string 45 | 46 | # render 47 | VBOSetupVisitor 48 | createGraphicsContext-ios 49 | createShaderProgram 50 | setupCamera 51 | 52 | # scene 53 | textureImageScene 54 | -------------------------------------------------------------------------------- /02.TextureImage/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /02.TextureImage/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/02.TextureImage/shot.png -------------------------------------------------------------------------------- /02.TextureImage/web/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+Logging 5 | Application+Rendering 6 | Application+frame 7 | Application+setupWindow-embedded 8 | Application+setupWindow-web 9 | 10 | MAIN_EXAMPLE_LOG 11 | Example 12 | Example+02 13 | Example+BoxScene 14 | Example+StaticPluginOSG 15 | Example+StaticPluginPNG 16 | Example+TextureImageScene 17 | Example+VBO 18 | 19 | main-web 20 | 21 | # log 22 | Logger 23 | log-default 24 | logLevelToString 25 | logprintf 26 | 27 | # format 28 | printfString 29 | 30 | # resource 31 | RESOURCE_LOG 32 | createTexture 33 | extension 34 | node 35 | setTextureImage 36 | string 37 | Resource 38 | ResourceStreamBuffer 39 | 40 | # render 41 | createShaderProgram 42 | setupCamera 43 | VBOSetupVisitor 44 | 45 | # scene 46 | textureImageScene 47 | -------------------------------------------------------------------------------- /03.HTTPClient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX03_HTTP_CLIENT) 10 | SET(EXAMPLE_BINARY_NAME "ex03-http-client") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /03.HTTPClient/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | # Include lipng-android CMakeLists.txt. 8 | INCLUDE(${OSGCPE_DIR}/libs/libpng-android/CMakeLists.txt) 9 | 10 | # Reference sources. 11 | INCLUDE_DIRECTORIES(src/main/cpp) 12 | # Create native library. 13 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 14 | 15 | FIND_LIBRARY(log-lib log) 16 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 17 | 18 | # Link native library with libraries. 19 | TARGET_LINK_LIBRARIES( 20 | library 21 | ${log-lib} 22 | ${OSGCPE_LINK_LIBS} 23 | ${IMAGE_LINK_LIBS} 24 | ) 25 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/cpp/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+HTTPClient 4 | Application+Logging 5 | Application+Rendering 6 | Application+camera 7 | Application+frame+Reporting 8 | Application+setupWindow-embedded 9 | 10 | MAIN_EXAMPLE_LOG 11 | Example 12 | Example+03 13 | Example+BoxScene 14 | Example+HTTPSGetPost 15 | Example+StaticPluginOSG 16 | Example+StaticPluginPNG 17 | Example+TextureImageScene 18 | Example+VBO 19 | 20 | library+Ex03+JNI-android 21 | 22 | library-android 23 | library+init-android 24 | library+frame-android 25 | library+httpClient-android 26 | library+jniStrings-android 27 | 28 | # core 29 | Reporter 30 | 31 | # log 32 | Logger 33 | log-android 34 | logLevelToString 35 | logprintf 36 | 37 | # format 38 | printfString 39 | 40 | # resource 41 | RESOURCE_LOG 42 | Resource 43 | ResourceStreamBuffer 44 | createTexture 45 | extension 46 | node 47 | setTextureImage 48 | string 49 | 50 | # render 51 | VBOSetupVisitor 52 | createShaderProgram 53 | 54 | # scene 55 | textureImageScene 56 | 57 | # network 58 | HTTPClient 59 | HTTPRequest 60 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex03 2 | EGLview 3 | HTTPClientProcessor 4 | HTTPRequest 5 | HTTPRequestDelegate 6 | MainActivity 7 | MainActivity+library+init 8 | MainActivity+library+frame 9 | MainActivity+HTTPClientProcessor 10 | RendererDelegate 11 | library 12 | library+init 13 | library+frame 14 | library+httpClient 15 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex03 3 | 4 | -------------------------------------------------------------------------------- /03.HTTPClient/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /03.HTTPClient/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /03.HTTPClient/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /03.HTTPClient/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /03.HTTPClient/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /03.HTTPClient/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /03.HTTPClient/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Build mongoose statically. 9 | INCLUDE(${OSGCPE_DIR}/libs/mongoose/CMakeLists.txt) 10 | 11 | # Reference sources. 12 | INCLUDE_DIRECTORIES(src) 13 | # Create executable. 14 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 15 | 16 | # Use ImageIO for macOS. 17 | IF (${OSG_PLATFORM} STREQUAL "macos") 18 | SET(IMAGE_LINK_LIBS "osgdb_imageio") 19 | # Use libpng for Linux and Windows. 20 | ELSE () 21 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 22 | ENDIF () 23 | 24 | # Link executable with libraries. 25 | TARGET_LINK_LIBRARIES( 26 | ${EXAMPLE_BINARY_NAME} 27 | ${OSGCPE_LINK_LIBS} 28 | ${IMAGE_LINK_LIBS} 29 | mongoose 30 | ) 31 | -------------------------------------------------------------------------------- /03.HTTPClient/desktop/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+HTTPClient 4 | Application+HTTPClientProcessor 5 | Application+Logging 6 | Application+Rendering 7 | Application+camera 8 | Application+frame+Reporting 9 | Application+run 10 | Application+setupWindow-desktop 11 | 12 | MAIN_EXAMPLE_LOG 13 | Example 14 | Example+03 15 | Example+BoxScene 16 | Example+HTTPSGetPost 17 | Example+StaticPluginOSG 18 | Example+StaticPluginPNG 19 | Example+TextureImageScene 20 | 21 | main-desktop 22 | 23 | # core 24 | Reporter 25 | 26 | # log 27 | Logger 28 | log-default 29 | logLevelToString 30 | logprintf 31 | 32 | # format 33 | printfString 34 | 35 | # resource 36 | RESOURCE_LOG 37 | Resource 38 | ResourceStreamBuffer 39 | createTexture 40 | extension 41 | node 42 | setTextureImage 43 | string 44 | 45 | # render 46 | createGraphicsContext-desktop 47 | createShaderProgram 48 | setupCamera 49 | 50 | # scene 51 | textureImageScene 52 | 53 | # network 54 | HTTPClient 55 | HTTPClientProcessor 56 | HTTPRequest 57 | HTTPRequestProcessorMongoose 58 | mongoose 59 | -------------------------------------------------------------------------------- /03.HTTPClient/ios/ex03.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03.HTTPClient/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /03.HTTPClient/ios/src/Features.txt: -------------------------------------------------------------------------------- 1 | # ios 2 | AppDelegate 3 | AppDelegate+HTTPClientProcessor-ios 4 | AppDelegate+RenderVC 5 | HTTPClientProcessor-ios 6 | RenderVC 7 | RenderVC+FrameReporting 8 | 9 | # main 10 | Application 11 | Application+HTTPClient 12 | Application+Logging 13 | Application+Rendering 14 | Application+camera 15 | Application+frame+Reporting 16 | Application+setupWindow-ios 17 | 18 | MAIN_EXAMPLE_LOG 19 | Example 20 | Example+03 21 | Example+BoxScene 22 | Example+HTTPSGetPost 23 | Example+StaticPluginOSG 24 | Example+StaticPluginPNG 25 | Example+TextureImageScene 26 | Example+VBO 27 | 28 | library-ios 29 | library+init-ios 30 | library+frame-ios 31 | library+httpClient-ios 32 | 33 | # core 34 | Reporter 35 | 36 | # log 37 | Logger 38 | log-default 39 | logLevelToString 40 | logprintf 41 | 42 | # format 43 | printfString 44 | 45 | # resource 46 | RESOURCE_LOG 47 | Resource 48 | ResourceStreamBuffer 49 | createTexture 50 | extension 51 | node 52 | setTextureImage 53 | string 54 | 55 | # render 56 | VBOSetupVisitor 57 | createGraphicsContext-ios 58 | createShaderProgram 59 | setupCamera 60 | 61 | # scene 62 | textureImageScene 63 | 64 | # network 65 | HTTPClient 66 | HTTPRequest 67 | -------------------------------------------------------------------------------- /03.HTTPClient/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /03.HTTPClient/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/03.HTTPClient/shot.png -------------------------------------------------------------------------------- /03.HTTPClient/web/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+HTTPClient 5 | Application+HTTPClientProcessor 6 | Application+Logging 7 | Application+Rendering 8 | Application+camera 9 | Application+frame+Reporting 10 | Application+setupWindow-embedded 11 | Application+setupWindow-web 12 | 13 | MAIN_EXAMPLE_LOG 14 | Example 15 | Example+03 16 | Example+BoxScene 17 | Example+HTTPSGetPost 18 | Example+StaticPluginOSG 19 | Example+StaticPluginPNG 20 | Example+TextureImageScene 21 | Example+VBO 22 | 23 | main-web 24 | 25 | # core 26 | Reporter 27 | 28 | # log 29 | Logger 30 | log-default 31 | logLevelToString 32 | logprintf 33 | 34 | # format 35 | printfString 36 | 37 | # resource 38 | RESOURCE_LOG 39 | Resource 40 | ResourceStreamBuffer 41 | createTexture 42 | extension 43 | node 44 | setTextureImage 45 | string 46 | 47 | # render 48 | VBOSetupVisitor 49 | createShaderProgram 50 | setupCamera 51 | 52 | # scene 53 | textureImageScene 54 | 55 | # network 56 | HTTPClient 57 | HTTPClientProcessor 58 | HTTPRequest 59 | HTTPRequestProcessorFetch 60 | fetch 61 | -------------------------------------------------------------------------------- /04.RemoteDebugging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX04_REMOTE_DEBUGGING) 10 | SET(EXAMPLE_BINARY_NAME "ex04-remote-debugging") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | # Include libpng-android CMakeLists.txt. 8 | INCLUDE(${OSGCPE_DIR}/libs/libpng-android/CMakeLists.txt) 9 | 10 | # Reference Android variant of NLohmann's JSON parsing library. 11 | INCLUDE(${OSGCPE_DIR}/libs/json-android/CMakeLists.txt) 12 | 13 | # Reference sources. 14 | INCLUDE_DIRECTORIES(src/main/cpp) 15 | # Create native library. 16 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 17 | 18 | FIND_LIBRARY(log-lib log) 19 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 20 | 21 | # Link native library with libraries. 22 | TARGET_LINK_LIBRARIES( 23 | library 24 | ${log-lib} 25 | ${OSGCPE_LINK_LIBS} 26 | ${IMAGE_LINK_LIBS} 27 | ) 28 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex04 2 | EGLview 3 | HTTPClientProcessor 4 | HTTPRequest 5 | HTTPRequestDelegate 6 | MainActivity 7 | MainActivity+library+init 8 | MainActivity+library+frame 9 | MainActivity+HTTPClientProcessor 10 | RendererDelegate 11 | library 12 | library+init 13 | library+frame 14 | library+httpClient 15 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex04 3 | 4 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /04.RemoteDebugging/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /04.RemoteDebugging/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /04.RemoteDebugging/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Build mongoose statically. 9 | INCLUDE(${OSGCPE_DIR}/libs/mongoose/CMakeLists.txt) 10 | # Reference NLohmann's JSON parsing library. 11 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/../json/single_include) 12 | 13 | # Reference sources. 14 | INCLUDE_DIRECTORIES(src) 15 | # Create executable. 16 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 17 | 18 | # Use ImageIO for macOS. 19 | IF (${OSG_PLATFORM} STREQUAL "macos") 20 | SET(IMAGE_LINK_LIBS "osgdb_imageio") 21 | # Use libpng for Linux and Windows. 22 | ELSE () 23 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 24 | ENDIF () 25 | 26 | # Link executable with libraries. 27 | TARGET_LINK_LIBRARIES( 28 | ${EXAMPLE_BINARY_NAME} 29 | ${OSGCPE_LINK_LIBS} 30 | ${IMAGE_LINK_LIBS} 31 | mongoose 32 | ) 33 | -------------------------------------------------------------------------------- /04.RemoteDebugging/ios/ex04.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /04.RemoteDebugging/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /04.RemoteDebugging/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /04.RemoteDebugging/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/04.RemoteDebugging/shot.png -------------------------------------------------------------------------------- /05.NodeSelection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX05_NODE_SELECTION) 10 | SET(EXAMPLE_BINARY_NAME "ex05-node-selection") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /05.NodeSelection/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | # Include lipng-android CMakeLists.txt. 8 | INCLUDE(${OSGCPE_DIR}/libs/libpng-android/CMakeLists.txt) 9 | 10 | # Reference sources. 11 | INCLUDE_DIRECTORIES(src/main/cpp) 12 | # Create native library. 13 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 14 | 15 | FIND_LIBRARY(log-lib log) 16 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 17 | 18 | # Link native library with libraries. 19 | TARGET_LINK_LIBRARIES( 20 | library 21 | ${log-lib} 22 | ${OSGCPE_LINK_LIBS} 23 | ${IMAGE_LINK_LIBS} 24 | ) 25 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/cpp/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Mouse 5 | Application+Rendering 6 | Application+camera 7 | Application+frame+Reporting 8 | Application+handleMousePress-android 9 | Application+setupWindow-embedded 10 | 11 | MAIN_EXAMPLE_LOG 12 | Example 13 | Example+05 14 | Example+BoxScene 15 | Example+BoxSelection 16 | Example+BoxRotation 17 | Example+StaticPluginOSG 18 | Example+StaticPluginPNG 19 | Example+TextureImageScene 20 | Example+VBO 21 | 22 | library+Ex05+JNI-android 23 | 24 | library-android 25 | library+init-android 26 | library+frame-android 27 | library+handleMousePress-android 28 | 29 | # core 30 | Reporter 31 | 32 | # log 33 | Logger 34 | log-android 35 | logLevelToString 36 | logprintf 37 | 38 | # format 39 | printfString 40 | 41 | # resource 42 | RESOURCE_LOG 43 | Resource 44 | ResourceStreamBuffer 45 | createTexture 46 | extension 47 | node 48 | setTextureImage 49 | string 50 | 51 | # render 52 | VBOSetupVisitor 53 | createShaderProgram 54 | 55 | # scene 56 | LinearInterpolator 57 | degreesToQuaternion 58 | nodeAtPosition 59 | quaternionToDegrees 60 | setSimpleRotation 61 | simpleRotation 62 | textureImageScene 63 | 64 | # input 65 | Mouse 66 | MouseButtons 67 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex05 2 | library 3 | library+init 4 | library+frame 5 | library+handleMousePress 6 | EGLview 7 | RendererDelegate 8 | MainActivity 9 | MainActivity+Input 10 | MainActivity+library+init 11 | MainActivity+library+frame 12 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex05 3 | 4 | -------------------------------------------------------------------------------- /05.NodeSelection/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /05.NodeSelection/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /05.NodeSelection/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /05.NodeSelection/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /05.NodeSelection/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /05.NodeSelection/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /05.NodeSelection/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Reference sources. 9 | INCLUDE_DIRECTORIES(src) 10 | # Create executable. 11 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 12 | 13 | # Use ImageIO for macOS. 14 | IF (${OSG_PLATFORM} STREQUAL "macos") 15 | SET(IMAGE_LINK_LIBS "osgdb_imageio") 16 | # Use libpng for Linux and Windows. 17 | ELSE () 18 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 19 | ENDIF () 20 | 21 | # Link executable with libraries. 22 | TARGET_LINK_LIBRARIES( 23 | ${EXAMPLE_BINARY_NAME} 24 | ${OSGCPE_LINK_LIBS} 25 | ${IMAGE_LINK_LIBS} 26 | ) 27 | -------------------------------------------------------------------------------- /05.NodeSelection/desktop/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+Logging 5 | Application+Mouse 6 | Application+Rendering 7 | Application+camera 8 | Application+frame+Reporting 9 | Application+run 10 | Application+setupWindow-desktop 11 | 12 | MAIN_EXAMPLE_LOG 13 | Example 14 | Example+05 15 | Example+BoxScene 16 | Example+BoxSelection 17 | Example+BoxRotation 18 | Example+StaticPluginOSG 19 | Example+StaticPluginPNG 20 | Example+TextureImageScene 21 | 22 | main-desktop 23 | 24 | # core 25 | Reporter 26 | 27 | # log 28 | Logger 29 | log-default 30 | logLevelToString 31 | logprintf 32 | 33 | # format 34 | printfString 35 | 36 | # resource 37 | RESOURCE_LOG 38 | Resource 39 | ResourceStreamBuffer 40 | createTexture 41 | extension 42 | node 43 | setTextureImage 44 | string 45 | 46 | # render 47 | createGraphicsContext-desktop 48 | createShaderProgram 49 | setupCamera 50 | 51 | # scene 52 | LinearInterpolator 53 | degreesToQuaternion 54 | nodeAtPosition 55 | quaternionToDegrees 56 | setSimpleRotation 57 | simpleRotation 58 | textureImageScene 59 | 60 | # input 61 | INPUT_MOUSE_LOG 62 | Mouse 63 | MouseButtons 64 | -------------------------------------------------------------------------------- /05.NodeSelection/ios/ex05.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /05.NodeSelection/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /05.NodeSelection/ios/src/Features.txt: -------------------------------------------------------------------------------- 1 | # ios 2 | AppDelegate 3 | AppDelegate+RenderVC 4 | RenderVC 5 | RenderVC+FrameReporting 6 | 7 | # main 8 | Application 9 | Application+Logging 10 | Application+Rendering 11 | Application+Mouse 12 | Application+camera 13 | Application+frame+Reporting 14 | Application+setupWindow-ios 15 | 16 | MAIN_EXAMPLE_LOG 17 | Example 18 | Example+05 19 | Example+BoxScene 20 | Example+BoxSelection 21 | Example+BoxRotation 22 | Example+StaticPluginOSG 23 | Example+StaticPluginPNG 24 | Example+TextureImageScene 25 | Example+VBO 26 | 27 | library-ios 28 | library+init-ios 29 | library+frame-ios 30 | 31 | # core 32 | Reporter 33 | 34 | # log 35 | Logger 36 | log-default 37 | logLevelToString 38 | logprintf 39 | 40 | # format 41 | printfString 42 | 43 | # resource 44 | RESOURCE_LOG 45 | Resource 46 | ResourceStreamBuffer 47 | createTexture 48 | extension 49 | node 50 | setTextureImage 51 | string 52 | 53 | # render 54 | VBOSetupVisitor 55 | createGraphicsContext-ios 56 | createShaderProgram 57 | setupCamera 58 | 59 | # scene 60 | LinearInterpolator 61 | degreesToQuaternion 62 | nodeAtPosition 63 | quaternionToDegrees 64 | setSimpleRotation 65 | simpleRotation 66 | textureImageScene 67 | 68 | # input 69 | Mouse 70 | MouseButtons 71 | -------------------------------------------------------------------------------- /05.NodeSelection/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /05.NodeSelection/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/05.NodeSelection/shot.png -------------------------------------------------------------------------------- /05.NodeSelection/web/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+Logging 5 | Application+Mouse 6 | Application+Rendering 7 | Application+camera 8 | Application+frame+Reporting 9 | Application+handleEvent-web 10 | Application+setupWindow-embedded 11 | Application+setupWindow-web 12 | 13 | MAIN_EXAMPLE_LOG 14 | Example 15 | Example+05 16 | Example+BoxScene 17 | Example+BoxSelection 18 | Example+BoxRotation 19 | Example+StaticPluginOSG 20 | Example+StaticPluginPNG 21 | Example+TextureImageScene 22 | Example+VBO 23 | 24 | main-web 25 | main+Input-web 26 | 27 | # core 28 | Reporter 29 | 30 | # log 31 | Logger 32 | log-default 33 | logLevelToString 34 | logprintf 35 | 36 | # format 37 | printfString 38 | 39 | # resource 40 | RESOURCE_LOG 41 | Resource 42 | ResourceStreamBuffer 43 | createTexture 44 | extension 45 | node 46 | setTextureImage 47 | string 48 | 49 | # render 50 | VBOSetupVisitor 51 | createShaderProgram 52 | setupCamera 53 | 54 | # scene 55 | LinearInterpolator 56 | degreesToQuaternion 57 | nodeAtPosition 58 | quaternionToDegrees 59 | setSimpleRotation 60 | simpleRotation 61 | textureImageScene 62 | 63 | # input 64 | Mouse 65 | MouseButtons 66 | -------------------------------------------------------------------------------- /06.CommandSequence/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NOTE This is a common CMakeLists.txt to be included by each platform's 2 | # NOTE specific CMakeLists.txt. 3 | # This CMakeLists.txt requires the following variables: 4 | # * OSGCPE_DIR 5 | # This CMakeLists.txt provides the following variables outside: 6 | # * EXAMPLE_BINARY_NAME 7 | # * OSGCPE_LINK_LIBS 8 | 9 | PROJECT(EX06_COMMAND_SEQUENCE) 10 | SET(EXAMPLE_BINARY_NAME "ex06-command-sequence") 11 | 12 | # Use C++11. 13 | ADD_DEFINITIONS("-std=c++11") 14 | 15 | # Build OpenSceneGraph statically. 16 | INCLUDE(${OSGCPE_DIR}/libs/OpenSceneGraph/CMakeLists.txt) 17 | 18 | # Reference resources. 19 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/data) 20 | 21 | # Provide libraries to link with. 22 | SET( 23 | OSGCPE_LINK_LIBS 24 | osgViewer 25 | osgUtil 26 | osgDB 27 | # osgDB plugins start. 28 | osgdb_osg 29 | osgdb_serializers_osg 30 | # osgDB plugins end. 31 | osgGA 32 | osg 33 | OpenThreads 34 | ) 35 | -------------------------------------------------------------------------------- /06.CommandSequence/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.4) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../../CMakeLists.txt) 7 | # Include lipng-android CMakeLists.txt. 8 | INCLUDE(${OSGCPE_DIR}/libs/libpng-android/CMakeLists.txt) 9 | 10 | # Reference sources. 11 | INCLUDE_DIRECTORIES(src/main/cpp) 12 | # Create native library. 13 | ADD_LIBRARY(library SHARED src/main/cpp/library.cpp) 14 | 15 | FIND_LIBRARY(log-lib log) 16 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 17 | 18 | # Link native library with libraries. 19 | TARGET_LINK_LIBRARIES( 20 | library 21 | ${log-lib} 22 | ${OSGCPE_LINK_LIBS} 23 | ${IMAGE_LINK_LIBS} 24 | ) 25 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/java/Features.txt: -------------------------------------------------------------------------------- 1 | Ex06 2 | library 3 | library+init 4 | library+frame 5 | library+handleMousePress 6 | EGLview 7 | RendererDelegate 8 | MainActivity 9 | MainActivity+Input 10 | MainActivity+library+init 11 | MainActivity+library+frame 12 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ex06 3 | 4 | -------------------------------------------------------------------------------- /06.CommandSequence/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /06.CommandSequence/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /06.CommandSequence/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /06.CommandSequence/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /06.CommandSequence/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 02 11:56:09 MSK 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /06.CommandSequence/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /06.CommandSequence/desktop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 4 | 5 | # Include common CMakeLists.txt. 6 | INCLUDE(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) 7 | 8 | # Reference sources. 9 | INCLUDE_DIRECTORIES(src) 10 | # Create executable. 11 | ADD_EXECUTABLE(${EXAMPLE_BINARY_NAME} src/main.cpp) 12 | 13 | # Use ImageIO for macOS. 14 | IF (${OSG_PLATFORM} STREQUAL "macos") 15 | SET(IMAGE_LINK_LIBS "osgdb_imageio") 16 | # Use libpng for Linux and Windows. 17 | ELSE () 18 | SET(IMAGE_LINK_LIBS "osgdb_png" "png") 19 | ENDIF () 20 | 21 | # Link executable with libraries. 22 | TARGET_LINK_LIBRARIES( 23 | ${EXAMPLE_BINARY_NAME} 24 | ${OSGCPE_LINK_LIBS} 25 | ${IMAGE_LINK_LIBS} 26 | ) 27 | -------------------------------------------------------------------------------- /06.CommandSequence/desktop/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | Application 3 | Application+Logging 4 | Application+Mouse 5 | Application+Rendering 6 | Application+camera 7 | Application+frame+Reporting 8 | Application+run 9 | Application+setupWindow-desktop 10 | 11 | MAIN_EXAMPLE_LOG 12 | Example 13 | Example+06 14 | Example+BoxScene 15 | Example+BoxSelection 16 | Example+SequenceTest 17 | Example+StaticPluginOSG 18 | Example+StaticPluginPNG 19 | Example+TextureImageScene 20 | 21 | main-desktop 22 | 23 | # core 24 | CORE_SEQUENCE_ACTION 25 | CORE_SEQUENCE_LOG 26 | Reporter 27 | Sequence 28 | 29 | # log 30 | Logger 31 | log-default 32 | logLevelToString 33 | logprintf 34 | 35 | # format 36 | printfString 37 | 38 | # resource 39 | RESOURCE_LOG 40 | Resource 41 | ResourceStreamBuffer 42 | createTexture 43 | extension 44 | node 45 | setTextureImage 46 | string 47 | 48 | # render 49 | createGraphicsContext-desktop 50 | createShaderProgram 51 | setupCamera 52 | 53 | # scene 54 | LinearInterpolator 55 | degreesToQuaternion 56 | nodeAtPosition 57 | quaternionToDegrees 58 | setSimpleRotation 59 | simpleRotation 60 | textureImageScene 61 | 62 | # input 63 | Mouse 64 | MouseButtons 65 | -------------------------------------------------------------------------------- /06.CommandSequence/ios/ex06.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /06.CommandSequence/ios/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /06.CommandSequence/ios/src/library.mm: -------------------------------------------------------------------------------- 1 | #include "library.cpp" 2 | -------------------------------------------------------------------------------- /06.CommandSequence/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/06.CommandSequence/shot.png -------------------------------------------------------------------------------- /06.CommandSequence/web/src/Features.txt: -------------------------------------------------------------------------------- 1 | # main 2 | MAIN_APPLICATION_LOG 3 | Application 4 | Application+Logging 5 | Application+Mouse 6 | Application+Rendering 7 | Application+camera 8 | Application+frame+Reporting 9 | Application+handleEvent-web 10 | Application+setupWindow-embedded 11 | Application+setupWindow-web 12 | 13 | MAIN_EXAMPLE_LOG 14 | Example 15 | Example+06 16 | Example+BoxScene 17 | Example+BoxSelection 18 | Example+SequenceTest 19 | Example+StaticPluginOSG 20 | Example+StaticPluginPNG 21 | Example+TextureImageScene 22 | Example+VBO 23 | 24 | main-web 25 | main+Input-web 26 | 27 | # core 28 | CORE_SEQUENCE_ACTION 29 | CORE_SEQUENCE_LOG 30 | Reporter 31 | Sequence 32 | 33 | # log 34 | Logger 35 | log-default 36 | logLevelToString 37 | logprintf 38 | 39 | # format 40 | printfString 41 | 42 | # resource 43 | RESOURCE_LOG 44 | Resource 45 | ResourceStreamBuffer 46 | createTexture 47 | extension 48 | node 49 | setTextureImage 50 | string 51 | 52 | # render 53 | VBOSetupVisitor 54 | createShaderProgram 55 | setupCamera 56 | 57 | # scene 58 | LinearInterpolator 59 | degreesToQuaternion 60 | nodeAtPosition 61 | quaternionToDegrees 62 | setSimpleRotation 63 | simpleRotation 64 | textureImageScene 65 | 66 | # input 67 | Mouse 68 | MouseButtons 69 | -------------------------------------------------------------------------------- /data/digit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/data/digit.png -------------------------------------------------------------------------------- /data/ppl.vert: -------------------------------------------------------------------------------- 1 | 2 | // Per-pixel (per-fragment) lighting. 3 | // Topic: Lambertian reflectance 4 | // Source: http://www.learnopengles.com/tag/lambertian-reflectance/ 5 | 6 | varying vec3 position; 7 | varying vec3 normal; 8 | 9 | varying vec2 texCoord; 10 | 11 | void main() 12 | { 13 | // Pass vertex. 14 | // Convert from Model/Object space to Screen one. 15 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 16 | 17 | // Pass position and normal in Camera/Eye space. 18 | position = vec3(gl_ModelViewMatrix * gl_Vertex); 19 | normal = vec3(gl_ModelViewMatrix * vec4(gl_Normal, 0.0)); 20 | 21 | // Pass texture coordinates. 22 | texCoord = gl_MultiTexCoord0.xy; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /features/android/Ex01.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex01; 3 | -------------------------------------------------------------------------------- /features/android/Ex02.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex02; 3 | -------------------------------------------------------------------------------- /features/android/Ex03.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex03; 3 | -------------------------------------------------------------------------------- /features/android/Ex04.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex04; 3 | -------------------------------------------------------------------------------- /features/android/Ex05.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex05; 3 | -------------------------------------------------------------------------------- /features/android/Ex06.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | package org.opengamestudio.ex06; 3 | -------------------------------------------------------------------------------- /features/android/HTTPRequestDelegate.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | interface HTTPRequestDelegate 3 | { 4 | void completeRequest(String id, boolean status, String response); 5 | } 6 | -------------------------------------------------------------------------------- /features/android/MainActivity+HTTPClientProcessor.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Setup 2 | this.setupHTTPClientProcessor(); 3 | 4 | FEATURE MainActivity.java/Process 5 | this.httpClientProcessor.process(); 6 | 7 | FEATURE MainActivity.java/Impl 8 | private HTTPClientProcessor httpClientProcessor = null; 9 | private void setupHTTPClientProcessor() 10 | { 11 | this.httpClientProcessor = new HTTPClientProcessor(); 12 | } 13 | -------------------------------------------------------------------------------- /features/android/MainActivity+library+frame.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | library.frame(); 3 | -------------------------------------------------------------------------------- /features/android/MainActivity+library+init.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | library.init(width, height); 3 | -------------------------------------------------------------------------------- /features/android/MainActivity.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Include 2 | import android.app.Activity; 3 | import android.os.Bundle; 4 | import android.widget.TextView; 5 | 6 | FEATURE MainActivity.java/Inherit 7 | public class MainActivity 8 | extends Activity 9 | implements RendererDelegate 10 | 11 | FEATURE MainActivity.java/Setup 12 | { 13 | private EGLview renderer = null; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) 17 | { 18 | super.onCreate(savedInstanceState); 19 | this.setContentView(R.layout.activity_main); 20 | this.setupRenderer(); 21 | 22 | FEATURE MainActivity.java/RendererInit 23 | } 24 | private void setupRenderer() 25 | { 26 | this.renderer = (EGLview)findViewById(R.id.render_surface); 27 | this.renderer.setDelegate(this); 28 | } 29 | public void rendererInit(int width, int height) 30 | { 31 | 32 | FEATURE MainActivity.java/RendererFrame 33 | } 34 | public void rendererFrame() 35 | { 36 | 37 | FEATURE MainActivity.java/Impl 38 | } 39 | 40 | FEATURE MainActivity.java/End 41 | } 42 | -------------------------------------------------------------------------------- /features/android/RendererDelegate.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | interface RendererDelegate 3 | { 4 | void rendererFrame(); 5 | void rendererInit(int width, int height); 6 | } 7 | -------------------------------------------------------------------------------- /features/android/library+frame.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | // Rendering. 3 | public static native void frame(); 4 | -------------------------------------------------------------------------------- /features/android/library+handleMousePress.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | // Input. 3 | public static native void handleMousePress(boolean down, float x, float y); 4 | -------------------------------------------------------------------------------- /features/android/library+httpClient.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | // Pop next pending request and execute it (implicitely mark it as IN_PROGRESS). 3 | public static native String[] httpClientExecuteNextRequest(); 4 | 5 | public static native void httpClientCompleteRequest(String id, boolean status, String response); 6 | -------------------------------------------------------------------------------- /features/android/library+init.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | // Setup graphics context. 3 | public static native void init(int width, int height); 4 | -------------------------------------------------------------------------------- /features/android/library.java: -------------------------------------------------------------------------------- 1 | FEATURE MainActivity.java/Impl 2 | class library 3 | { 4 | static 5 | { 6 | System.loadLibrary("library"); 7 | } 8 | 9 | FEATURE MainActivity.java/End 10 | } 11 | 12 | -------------------------------------------------------------------------------- /features/core/CORE_REPORTER_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE core.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define CORE_REPORTER_LOG_PREFIX "core::Reporter(%p) %s" 5 | #define CORE_REPORTER_LOG(...) \ 6 | log::logprintf( \ 7 | CORE_REPORTER_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /features/core/CORE_SEQUENCE_ACTION.cpp: -------------------------------------------------------------------------------- 1 | FEATURE core.h/Impl 2 | #define CORE_SEQUENCE_ACTION(NAME, CALL) \ 3 | core::Sequence::Action(NAME, [=]() { return CALL; }) 4 | -------------------------------------------------------------------------------- /features/core/CORE_SEQUENCE_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE core.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define CORE_SEQUENCE_LOG_PREFIX "core::Sequence(%p) %s" 5 | #define CORE_SEQUENCE_LOG(...) \ 6 | log::logprintf( \ 7 | CORE_SEQUENCE_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /features/debug/DEBUG_DEBUGGER_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define DEBUG_DEBUGGER_LOG_PREFIX "debug::Debugger(%p) %s" 5 | #define DEBUG_DEBUGGER_LOG(...) \ 6 | log::logprintf( \ 7 | DEBUG_DEBUGGER_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | -------------------------------------------------------------------------------- /features/debug/DEBUG_PAGE_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define DEBUG_PAGE_LOG_PREFIX "debug::Page(%p) %s" 5 | #define DEBUG_PAGE_LOG(...) \ 6 | log::logprintf( \ 7 | DEBUG_PAGE_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /features/debug/Debugger+page.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | public: 3 | Page *page(const std::string &title) 4 | { 5 | auto pageCount = this->pages.size(); 6 | for (auto i = 0; i < pageCount; ++i) 7 | { 8 | Page *page = &this->pages[i]; 9 | if (page->title == title) 10 | { 11 | return page; 12 | } 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /features/debug/Debugger+processJSON.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | public: 3 | void processJSON(const std::string &data) 4 | { 5 | // TODO Work with PageDesc here instead of raw JSON? 6 | auto jdata = nlohmann::json::parse(data); 7 | auto debuggerTitle = jdata["title"].get(); 8 | // Ignore different debuggers. 9 | if (debuggerTitle != this->title) 10 | { 11 | DEBUG_DEBUGGER_LOG("WARNING Ignoring debugger with different title"); 12 | return; 13 | } 14 | auto jpages = jdata["pages"]; 15 | for (auto jpage : jpages) 16 | { 17 | auto pageDesc = jsonToPageDesc(jpage); 18 | auto page = this->page(pageDesc.title); 19 | if (page) 20 | { 21 | page->setDesc(pageDesc); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /features/debug/Debugger.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Include 2 | #include "network.h" 3 | #include 4 | 5 | FEATURE debug.h/Begin 6 | //! Accumulates and processes DebugPages with the help of network::HTTPClient. 7 | class Debugger 8 | { 9 | private: 10 | network::HTTPClient *httpClient; 11 | public: 12 | const std::string title; 13 | 14 | Debugger( 15 | network::HTTPClient *httpClient, 16 | const std::string &title 17 | ) : 18 | httpClient(httpClient), 19 | title(title) 20 | { } 21 | 22 | private: 23 | std::string brokerURL; 24 | public: 25 | void setBrokerURL(const std::string &url) 26 | { 27 | this->brokerURL = url; 28 | } 29 | 30 | private: 31 | std::vector pages; 32 | public: 33 | void addPage(Page page) 34 | { 35 | this->pages.push_back(page); 36 | } 37 | 38 | FEATURE debug.h/End 39 | }; 40 | -------------------------------------------------------------------------------- /features/debug/Page+item.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | Item *item(const std::string &title) 3 | { 4 | auto itemCount = this->items.size(); 5 | for (auto i = 0; i < itemCount; ++i) 6 | { 7 | Item *item = &this->items[i]; 8 | if (item->title == title) 9 | { 10 | return item; 11 | } 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /features/debug/Page+setDesc.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | void setDesc(const PageDesc& desc) 3 | { 4 | for (auto descItem : desc.items) 5 | { 6 | auto item = this->item(descItem.title); 7 | if (item && item->setter) 8 | { 9 | item->setter(descItem.value); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /features/debug/Page.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Include 2 | #include 3 | 4 | FEATURE debug.h/Begin 5 | //! Provides debug page with items to alter. 6 | struct Page 7 | { 8 | 9 | // SETUP. 10 | 11 | std::string title; 12 | 13 | Page(const std::string &title = "") : title(title) { } 14 | 15 | // ITEMS. 16 | 17 | typedef std::function GetterCallback; 18 | typedef std::function SetterCallback; 19 | 20 | struct Item 21 | { 22 | std::string title; 23 | GetterCallback getter; 24 | SetterCallback setter; 25 | }; 26 | std::vector items; 27 | 28 | //! Convenience function to add items. 29 | void addItem( 30 | const std::string &title, 31 | GetterCallback getter, 32 | SetterCallback setter = nullptr 33 | ) { 34 | this->items.push_back({title, getter, setter}); 35 | } 36 | 37 | FEATURE debug.h/End 38 | }; 39 | -------------------------------------------------------------------------------- /features/debug/PageDesc.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Include 2 | #include 3 | #include 4 | 5 | FEATURE debug.h/Impl 6 | //! Provides serializable representation of a Page instance. 7 | struct PageDesc 8 | { 9 | std::string title; 10 | 11 | struct Item 12 | { 13 | std::string title; 14 | std::string value; 15 | }; 16 | std::vector items; 17 | }; 18 | -------------------------------------------------------------------------------- /features/debug/debuggerToJSON.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | std::string debuggerToJSON( 3 | const std::string &debuggerTitle, 4 | const std::vector &pages 5 | ) { 6 | std::string pagesJSON = ""; 7 | for (auto page : pages) 8 | { 9 | // Add comma if we're adding the second and following pages. 10 | if (!pagesJSON.empty()) 11 | { 12 | pagesJSON += ","; 13 | } 14 | pagesJSON += pageToJSON(page); 15 | } 16 | 17 | // Format debugger. 18 | std::string json; 19 | json += "{"; 20 | 21 | json += "\"title\":\""; 22 | json += debuggerTitle; 23 | json += "\","; 24 | 25 | json += "\"pages\":["; 26 | json += pagesJSON; 27 | json += "]"; // Note the absent comma. 28 | 29 | json += "}"; 30 | 31 | return json; 32 | } 33 | -------------------------------------------------------------------------------- /features/debug/jsonToPageDesc.cpp: -------------------------------------------------------------------------------- 1 | FEATURE debug.h/Impl 2 | PageDesc jsonToPageDesc(const nlohmann::json &data) 3 | { 4 | PageDesc desc; 5 | 6 | // Title. 7 | desc.title = data["title"].get(); 8 | 9 | // Convert JSON items to DebugPageDesc items. 10 | auto items = data["items"]; 11 | for (auto item : items) 12 | { 13 | auto title = item["title"].get(); 14 | auto value = item["value"].get(); 15 | desc.items.push_back({ title, value }); 16 | } 17 | 18 | return desc; 19 | } 20 | -------------------------------------------------------------------------------- /features/format/commandLineArgumentsToParameters.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Include 2 | #include 3 | 4 | FEATURE format.h/Impl 5 | typedef std::map Parameters; 6 | //! Convert command line arguments in the form of `--key=value` to parameters. 7 | Parameters commandLineArgumentsToParameters( 8 | int argc, 9 | char *argv[] 10 | ) { 11 | Parameters parameters; 12 | // Start with index #1 because index #0 contains program name. 13 | for (auto i = 1; i < argc; ++i) 14 | { 15 | auto argument = std::string(argv[i]); 16 | // Only accept arguments starting with `--`. 17 | if (format::stringStartsWith(argument, "--")) 18 | { 19 | // Skip the dashes. 20 | auto option = argument.substr(2); 21 | auto keyAndValue = format::splitString(option, "="); 22 | if (keyAndValue.size() == 2) 23 | { 24 | auto key = keyAndValue[0]; 25 | auto value = keyAndValue[1]; 26 | parameters[key] = value; 27 | } 28 | } 29 | } 30 | return parameters; 31 | } 32 | -------------------------------------------------------------------------------- /features/format/printfString.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Include 2 | #include 3 | 4 | FEATURE format.h/Impl 5 | //! Construct a string using printf-like syntax. 6 | std::string printfString(const char *fmt, ...) 7 | { 8 | const int PRINTF_STRING_MAX_STRLEN = 1024; 9 | va_list args; 10 | char msg[PRINTF_STRING_MAX_STRLEN]; 11 | va_start(args, fmt); 12 | vsnprintf(msg, PRINTF_STRING_MAX_STRLEN, fmt, args); 13 | va_end(args); 14 | return msg; 15 | } 16 | -------------------------------------------------------------------------------- /features/format/splitString.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Impl 2 | //! Split a string into a list of strings using a single character. 3 | std::vector splitString(const std::string &s, const char *c) 4 | { 5 | size_t pos = 0; 6 | bool proceed = true; 7 | bool hasChar = false; 8 | std::vector result; 9 | while (proceed) 10 | { 11 | auto id = s.find(c, pos); 12 | if (id != std::string::npos) 13 | { 14 | result.push_back(s.substr(pos, id - pos)); 15 | pos = id + 1; 16 | hasChar = true; 17 | } 18 | else 19 | { 20 | result.push_back(s.substr(pos, s.length())); 21 | proceed = false; 22 | // If delimiting char has not been found, 23 | // the result should only contain original string. 24 | } 25 | } 26 | return result; 27 | } 28 | -------------------------------------------------------------------------------- /features/format/stringStartsWith.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Impl 2 | //! Find prefix in the provided string. 3 | bool stringStartsWith(const std::string &s, const std::string &prefix) 4 | { 5 | // Source: https://stackoverflow.com/a/8095127 6 | // Topic: how to check string start in C++ 7 | return 8 | (prefix.length() <= s.length()) && 9 | std::equal(prefix.begin(), prefix.end(), s.begin()) 10 | ; 11 | } 12 | -------------------------------------------------------------------------------- /features/format/trimmedString.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Impl 2 | //! Trim non-visible characters at the beginning and at the end. 3 | std::string trimmedString(const std::string &s) 4 | { 5 | // Source: https://stackoverflow.com/a/21698913 6 | // Topic: What's the best way to trim std::string? 7 | 8 | // Find the first position without space characters. 9 | std::string::const_iterator it = s.begin(); 10 | while ( 11 | (it != s.end()) && 12 | std::isspace(*it) 13 | ) { 14 | ++it; 15 | } 16 | 17 | // Find the last position without space characters. 18 | std::string::const_reverse_iterator rit = s.rbegin(); 19 | while ( 20 | (rit.base() != it) && 21 | std::isspace(*rit) 22 | ) { 23 | ++rit; 24 | } 25 | 26 | return std::string(it, rit.base()); 27 | } 28 | -------------------------------------------------------------------------------- /features/format/urlQueryToParameters.cpp: -------------------------------------------------------------------------------- 1 | FEATURE format.h/Include 2 | #include 3 | 4 | FEATURE format.h/Impl 5 | typedef std::map Parameters; 6 | //! Convert query parameters starting after `?` that are in the form of `key=value` to parameters. 7 | Parameters urlQueryToParameters( 8 | int argc, 9 | char *argv[] 10 | ) { 11 | Parameters parameters; 12 | 13 | // No query has been provided. Nothing to parse. 14 | if (argc < 2) 15 | { 16 | return parameters; 17 | } 18 | 19 | auto query = argv[1]; 20 | auto options = format::splitString(query, "&"); 21 | 22 | for (auto option : options) 23 | { 24 | auto keyAndValue = format::splitString(option, "="); 25 | if (keyAndValue.size() == 2) 26 | { 27 | auto key = keyAndValue[0]; 28 | auto value = keyAndValue[1]; 29 | parameters[key] = value; 30 | } 31 | } 32 | return parameters; 33 | } 34 | -------------------------------------------------------------------------------- /features/input/OSGCPE_INPUT_MOUSE_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE input.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define OSGCPE_INPUT_MOUSE_LOG_PREFIX "osgcpe::input::Mouse(%p) %s" 5 | #define OSGCPE_INPUT_MOUSE_LOG(...) \ 6 | osgcpe::log::logprintf( \ 7 | OSGCPE_INPUT_MOUSE_LOG_PREFIX, \ 8 | this, \ 9 | osgcpe::format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | -------------------------------------------------------------------------------- /features/ios/AppDelegate+HTTPClientProcessor-ios.mm: -------------------------------------------------------------------------------- 1 | FEATURE ios.mm/Properties 2 | @property (nonatomic, strong) HTTPClientProcessor *httpClientProcessor; 3 | 4 | FEATURE ios.mm/Setup 5 | [self setupHTTPClientProcessor]; 6 | 7 | FEATURE ios.mm/Impl 8 | - (void)setupHTTPClientProcessor 9 | { 10 | self.httpClientProcessor = [HTTPClientProcessor new]; 11 | 12 | // Run the processor each frame. 13 | 14 | // NOTE Create weak reference to `self` to escape so-called retain cycle. 15 | // NOTE Without `weakification` we get compile time warning from ARC. 16 | //__weak typeof(self)weakSelf = self; 17 | 18 | self.renderVC.frame = ^() { 19 | // NOTE Convert weak self to strong self. 20 | //__strong typeof(self)self = weakSelf; 21 | 22 | [self.httpClientProcessor process]; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /features/ios/AppDelegate+RenderVC.mm: -------------------------------------------------------------------------------- 1 | FEATURE ios.mm/Properties 2 | @property (nonatomic, strong) RenderVC *renderVC; 3 | 4 | FEATURE ios.mm/Setup 5 | [self setupRenderVC]; 6 | 7 | FEATURE ios.mm/Impl 8 | - (void)setupRenderVC 9 | { 10 | self.renderVC = [RenderVC new]; 11 | self.window.rootViewController = self.renderVC; 12 | } 13 | -------------------------------------------------------------------------------- /features/ios/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | FEATURE ios.h/Impl 2 | @interface AppDelegate : UIResponder 3 | @property (nonatomic, strong) UIWindow *window; 4 | @end 5 | 6 | FEATURE ios.mm/Properties 7 | @interface AppDelegate () 8 | 9 | FEATURE ios.mm/Setup 10 | @end 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application 15 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | auto frame = [[UIScreen mainScreen] bounds]; 18 | self.window = [[UIWindow alloc] initWithFrame:frame]; 19 | 20 | FEATURE ios.mm/Impl 21 | self.window.backgroundColor = UIColor.whiteColor; 22 | [self.window makeKeyAndVisible]; 23 | 24 | return YES; 25 | } 26 | 27 | FEATURE ios.mm/End 28 | @end 29 | -------------------------------------------------------------------------------- /features/ios/RenderVC+FrameReporting.mm: -------------------------------------------------------------------------------- 1 | FEATURE ios.h/Properties 2 | @property (nonatomic, copy) void (^frame)(); 3 | 4 | FEATURE ios.mm/Frame 5 | [self reportFrame]; 6 | 7 | FEATURE ios.mm/Impl 8 | - (void)reportFrame 9 | { 10 | if (self.frame != nil) 11 | { 12 | self.frame(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /features/log/Logger.cpp: -------------------------------------------------------------------------------- 1 | FEATURE log.h/Impl 2 | //! Print OpenSceneGraph notifications to console. 3 | class Logger : public osg::NotifyHandler 4 | { 5 | public: 6 | Logger(const std::string &domain = "") : domain(domain) { } 7 | virtual ~Logger() { } 8 | 9 | // Override NotifyHandler::notify() to receive OpenSceneGraph notifications. 10 | void notify(osg::NotifySeverity severity, const char *message) override 11 | { 12 | logprintf( 13 | "%s OSG/%s %s", 14 | domain.c_str(), 15 | logLevelToString(severity).c_str(), 16 | message 17 | ); 18 | } 19 | 20 | private: 21 | const std::string domain; 22 | }; 23 | -------------------------------------------------------------------------------- /features/log/log-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE log.h/Include 2 | #include 3 | 4 | FEATURE log.h/Impl 5 | //! Cross-platform logging function. 6 | void log(const char *message) 7 | { 8 | __android_log_write(ANDROID_LOG_ERROR, "OSG", message); 9 | } 10 | -------------------------------------------------------------------------------- /features/log/log-default.cpp: -------------------------------------------------------------------------------- 1 | FEATURE log.h/Include 2 | #include 3 | 4 | FEATURE log.h/Impl 5 | //! Cross-platform logging function. 6 | void log(const char *message) 7 | { 8 | std::cout << message << std::endl; 9 | } 10 | -------------------------------------------------------------------------------- /features/log/logLevelToString.cpp: -------------------------------------------------------------------------------- 1 | FEATURE log.h/Include 2 | #include 3 | 4 | FEATURE log.h/Impl 5 | //! Convert OpenSceneGraph log level to string. 6 | std::string logLevelToString(osg::NotifySeverity severity) 7 | { 8 | switch (severity) 9 | { 10 | case osg::DEBUG_FP: 11 | // Verbose. 12 | return "V"; 13 | case osg::DEBUG_INFO: 14 | // Debug. 15 | return "D"; 16 | case osg::NOTICE: 17 | case osg::INFO: 18 | // Info. 19 | return "I"; 20 | case osg::WARN: 21 | // Warning. 22 | return "W"; 23 | case osg::FATAL: 24 | case osg::ALWAYS: 25 | // Error. 26 | return "E"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /features/log/logprintf.cpp: -------------------------------------------------------------------------------- 1 | FEATURE log.h/Include 2 | #include 3 | 4 | FEATURE log.h/Impl 5 | //! Cross-platform logging function with printf-like syntax. 6 | void logprintf(const char *fmt, ...) 7 | { 8 | const int PRINTF_STRING_MAX_STRLEN = 1024; 9 | va_list args; 10 | char msg[PRINTF_STRING_MAX_STRLEN]; 11 | va_start(args, fmt); 12 | vsnprintf(msg, PRINTF_STRING_MAX_STRLEN, fmt, args); 13 | va_end(args); 14 | log(msg); 15 | } 16 | -------------------------------------------------------------------------------- /features/main/Application+CameraManipulator.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include 3 | 4 | FEATURE main.h/Setup 5 | this->setupCameraManipulator(); 6 | 7 | FEATURE main.h/Impl 8 | private: 9 | osg::ref_ptr cameraManip; 10 | void setupCameraManipulator() 11 | { 12 | // Create manipulator: CRITICAL for mobile and web. 13 | this->cameraManip = new osgGA::TrackballManipulator; 14 | this->viewer->setCameraManipulator(this->cameraManip); 15 | } 16 | public: 17 | osgGA::TrackballManipulator *cameraManipulator() 18 | { 19 | return this->cameraManip; 20 | } 21 | -------------------------------------------------------------------------------- /features/main/Application+Debugging.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "debug.h" 3 | 4 | FEATURE main.h/Setup 5 | // NOTE Do not use `-` because it breaks everything. 6 | this->setupDebugging("OSGCPE04"); 7 | 8 | FEATURE main.h/TearDown 9 | this->tearDebuggingDown(); 10 | 11 | FEATURE main.h/Impl 12 | public: 13 | debug::Debugger *debugger; 14 | private: 15 | const std::string debuggerCallbackName = "Debugger"; 16 | 17 | void setupDebugging(const std::string &name) 18 | { 19 | this->debugger = new debug::Debugger(this->httpClient, name); 20 | this->debugger->setBrokerURL("https://osgcpe-debug-broker.herokuapp.com"); 21 | 22 | // Subscribe debugger to be processed each frame. 23 | this->frameReporter.addCallback( 24 | [&] { 25 | this->debugger->process(); 26 | }, 27 | this->debuggerCallbackName 28 | ); 29 | } 30 | void tearDebuggingDown() 31 | { 32 | // Unsubscribe debugger. 33 | this->frameReporter.removeCallback(this->debuggerCallbackName); 34 | delete this->debugger; 35 | } 36 | -------------------------------------------------------------------------------- /features/main/Application+HTTPClient.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "network.h" 3 | 4 | FEATURE main.h/Setup 5 | this->setupHTTPClient(); 6 | 7 | FEATURE main.h/TearDown 8 | this->tearHTTPClientDown(); 9 | 10 | FEATURE main.h/Impl 11 | public: 12 | network::HTTPClient *httpClient; 13 | private: 14 | void setupHTTPClient() 15 | { 16 | this->httpClient = new network::HTTPClient; 17 | } 18 | void tearHTTPClientDown() 19 | { 20 | delete this->httpClient; 21 | } 22 | -------------------------------------------------------------------------------- /features/main/Application+HTTPClientProcessor.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Setup 2 | this->setupHTTPClientProcessor(); 3 | 4 | FEATURE main.h/TearDown 5 | this->tearHTTPClientProcessorDown(); 6 | 7 | FEATURE main.h/Impl 8 | public: 9 | network::HTTPClientProcessor *httpClientProcessor; 10 | private: 11 | const std::string httpClientProcessorCallbackName = "HTTPClientProcessor"; 12 | 13 | void setupHTTPClientProcessor() 14 | { 15 | this->httpClientProcessor = new network::HTTPClientProcessor(this->httpClient); 16 | // Subscribe processor to be processed each frame. 17 | this->frameReporter.addCallback( 18 | [&] { 19 | this->httpClientProcessor->process(); 20 | }, 21 | this->httpClientProcessorCallbackName 22 | ); 23 | } 24 | void tearHTTPClientProcessorDown() 25 | { 26 | this->frameReporter.removeCallback(this->httpClientProcessorCallbackName); 27 | delete this->httpClientProcessor; 28 | } 29 | -------------------------------------------------------------------------------- /features/main/Application+Logging.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "log.h" 3 | 4 | FEATURE main.h/Setup 5 | this->setupLogging(name); 6 | 7 | FEATURE main.h/TearDown 8 | this->tearLoggingDown(); 9 | 10 | FEATURE main.h/Impl 11 | private: 12 | log::Logger *logger; 13 | void setupLogging(const std::string &appName) 14 | { 15 | // Create custom logger. 16 | this->logger = new log::Logger(appName); 17 | // Provide the logger to OpenSceneGraph. 18 | osg::setNotifyHandler(this->logger); 19 | // Only accept notifications of Info level or higher 20 | // like warnings and errors. 21 | //osg::setNotifyLevel(osg::INFO); 22 | osg::setNotifyLevel(osg::WARN); 23 | } 24 | void tearLoggingDown() 25 | { 26 | // Remove the logger from OpenSceneGraph. 27 | // This also destroys the logger: no need to deallocate it manually. 28 | osg::setNotifyHandler(0); 29 | } 30 | -------------------------------------------------------------------------------- /features/main/Application+Mouse.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "input.h" 3 | 4 | FEATURE main.h/Setup 5 | this->setupMouse(); 6 | 7 | FEATURE main.h/TearDown 8 | this->tearMouseDown(); 9 | 10 | FEATURE main.h/Impl 11 | public: 12 | osg::ref_ptr mouse; 13 | private: 14 | void setupMouse() 15 | { 16 | // Create mouse events' handler. 17 | this->mouse = new input::Mouse; 18 | // Register it. 19 | this->viewer->addEventHandler(this->mouse); 20 | } 21 | void tearMouseDown() 22 | { 23 | // This also removes Mouse instance. 24 | this->viewer->removeEventHandler(this->mouse); 25 | } 26 | -------------------------------------------------------------------------------- /features/main/Application+Rendering.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "render.h" 3 | 4 | #include 5 | #include 6 | 7 | FEATURE main.h/Setup 8 | this->setupRendering(); 9 | 10 | FEATURE main.h/TearDown 11 | this->tearRenderingDown(); 12 | 13 | FEATURE main.h/Impl 14 | public: 15 | void setScene(osg::Node *scene) 16 | { 17 | // Make sure we reset the scene upon setting the same scene again. 18 | this->viewer->setSceneData(0); 19 | this->viewer->setSceneData(scene); 20 | } 21 | private: 22 | osgViewer::Viewer *viewer; 23 | void setupRendering() 24 | { 25 | // Create OpenSceneGraph viewer. 26 | this->viewer = new osgViewer::Viewer; 27 | // Use single thread: CRITICAL for mobile and web. 28 | this->viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded); 29 | // Create manipulator: CRITICAL for mobile and web. 30 | this->viewer->setCameraManipulator(new osgGA::TrackballManipulator); 31 | } 32 | void tearRenderingDown() 33 | { 34 | delete this->viewer; 35 | } 36 | -------------------------------------------------------------------------------- /features/main/Application+camera.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | public: 3 | osg::Camera *camera() 4 | { 5 | return this->viewer->getCamera(); 6 | } 7 | -------------------------------------------------------------------------------- /features/main/Application+frame+Reporting.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "core.h" 3 | 4 | FEATURE main.h/Impl 5 | public: 6 | core::Reporter frameReporter; 7 | void frame() 8 | { 9 | this->viewer->frame(); 10 | this->frameReporter.report(); 11 | } 12 | -------------------------------------------------------------------------------- /features/main/Application+frame.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | public: 3 | void frame() 4 | { 5 | this->viewer->frame(); 6 | } 7 | -------------------------------------------------------------------------------- /features/main/Application+handleMousePress-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | public: 3 | void handleMousePress(bool down, float x, float y) 4 | { 5 | auto queue = this->viewer->getEventQueue(); 6 | float correctedY = (this->windowHeight - y); 7 | if (down) 8 | { 9 | queue->mouseButtonPress(x, correctedY, 1 /* LMB */); 10 | } 11 | else 12 | { 13 | queue->mouseButtonRelease(x, correctedY, 1 /* LMB */); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /features/main/Application+run.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | public: 3 | void run() 4 | { 5 | while (!this->viewer->done()) 6 | { 7 | this->frame(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /features/main/Application+setupWindow-desktop.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | public: 3 | void setupWindow( 4 | const std::string &title, 5 | int x, 6 | int y, 7 | int width, 8 | int height 9 | ) { 10 | osg::GraphicsContext *gc = 11 | render::createGraphicsContext(title, x, y, width, height); 12 | // Configure viewer's camera with FOVY and window size. 13 | osg::Camera *cam = this->viewer->getCamera(); 14 | render::setupCamera(cam, gc, 30, width, height); 15 | } 16 | -------------------------------------------------------------------------------- /features/main/Application+setupWindow-embedded.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | private: 3 | int windowWidth; 4 | int windowHeight; 5 | public: 6 | void setupWindow(int width, int height) 7 | { 8 | this->viewer->setUpViewerAsEmbeddedInWindow(0, 0, width, height); 9 | this->windowWidth = width; 10 | this->windowHeight = height; 11 | } 12 | -------------------------------------------------------------------------------- /features/main/Application+setupWindow-ios.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | UIView *setupWindow( 3 | int width, 4 | int height, 5 | float scale, 6 | UIView *parentView 7 | ) { 8 | osgViewer::GraphicsWindowIOS *gc = 9 | dynamic_cast( 10 | render::createGraphicsContext(width, height, scale, parentView) 11 | ); 12 | // Configure viewer's camera with FOVY and window size. 13 | osg::Camera *cam = this->viewer->getCamera(); 14 | render::setupCamera(cam, gc, 30, width * scale, height * scale); 15 | // Return UIView for embedding. 16 | return (UIView *)gc->getView(); 17 | } 18 | -------------------------------------------------------------------------------- /features/main/Application.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Setup 2 | class Application 3 | { 4 | public: 5 | Application(const std::string &name) 6 | { 7 | 8 | FEATURE main.h/TearDown 9 | } 10 | ~Application() 11 | { 12 | 13 | FEATURE main.h/Impl 14 | } 15 | 16 | FEATURE main.h/End 17 | }; 18 | -------------------------------------------------------------------------------- /features/main/Example+01.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-01: Embed resource"; 3 | -------------------------------------------------------------------------------- /features/main/Example+02.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-02: Texture image"; 3 | -------------------------------------------------------------------------------- /features/main/Example+03.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-03: HTTP client"; 3 | -------------------------------------------------------------------------------- /features/main/Example+04.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-04: Remote debugging"; 3 | -------------------------------------------------------------------------------- /features/main/Example+05.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-05: Node selection"; 3 | -------------------------------------------------------------------------------- /features/main/Example+06.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "OSGCPE-06: Command sequence"; 3 | -------------------------------------------------------------------------------- /features/main/Example+07.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Title 2 | const auto EXAMPLE_TITLE = "EX-07: full page"; 3 | -------------------------------------------------------------------------------- /features/main/Example+BoxScene.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "box.osgt.h" 3 | #include "resource.h" 4 | #include "scene.h" 5 | 6 | #include 7 | 8 | FEATURE main.h/Setup 9 | this->setupBoxScene(); 10 | 11 | FEATURE main.h/Impl 12 | private: 13 | osg::ref_ptr scene; 14 | 15 | void setupBoxScene() 16 | { 17 | resource::Resource box("models", "box.osgt", box_osgt, box_osgt_len); 18 | auto node = resource::node(box); 19 | // Use MatrixTransform to allow box transformations. 20 | if (node) 21 | { 22 | this->scene = new osg::MatrixTransform; 23 | this->scene->addChild(node); 24 | } 25 | if (this->scene.valid()) 26 | { 27 | this->app->setScene(scene); 28 | } 29 | else 30 | { 31 | MAIN_EXAMPLE_LOG("ERROR Could not load scene"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /features/main/Example+SingleColorScene.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Setup 2 | this->setupSceneTexturing(); 3 | 4 | FEATURE main.h/Impl 5 | private: 6 | void setupSceneTexturing() 7 | { 8 | // Do nothing for an empty scene. 9 | if (!this->scene.valid()) 10 | { 11 | return; 12 | } 13 | 14 | osgcpe::scene::paintScene(this->scene); 15 | } 16 | -------------------------------------------------------------------------------- /features/main/Example+StaticPluginOSG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | #include 3 | 4 | // Reference (statically) plugins to read `osgt` file. 5 | USE_OSGPLUGIN(osg2) 6 | USE_SERIALIZER_WRAPPER_LIBRARY(osg) 7 | -------------------------------------------------------------------------------- /features/main/Example+StaticPluginPNG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | #include 3 | 4 | // Reference (statically) plugins to read `png` file. 5 | // Apple platforms use ImageIO. All others use libpng. 6 | #ifdef __APPLE__ 7 | USE_OSGPLUGIN(imageio) 8 | #else 9 | USE_OSGPLUGIN(png) 10 | #endif 11 | -------------------------------------------------------------------------------- /features/main/Example+TextureImageScene.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "resource.h" 3 | #include "ppl.frag.h" 4 | #include "ppl.vert.h" 5 | #include "digit.png.h" 6 | 7 | FEATURE main.h/Setup 8 | this->setupSceneTexturing(); 9 | 10 | FEATURE main.h/Impl 11 | private: 12 | void setupSceneTexturing() 13 | { 14 | // Do nothing for an empty scene. 15 | if (!this->scene.valid()) 16 | { 17 | return; 18 | } 19 | resource::Resource shaderFrag("shaders", "ppl.frag", ppl_frag, ppl_frag_len); 20 | resource::Resource shaderVert("shaders", "ppl.vert", ppl_vert, ppl_vert_len); 21 | resource::Resource texture("images", "digit.png", digit_png, digit_png_len); 22 | scene::textureImageScene(this->scene, shaderFrag, shaderVert, texture); 23 | } 24 | -------------------------------------------------------------------------------- /features/main/Example+VBO.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Include 2 | #include "render.h" 3 | 4 | FEATURE main.h/Setup 5 | this->setupSceneVBO(); 6 | 7 | FEATURE main.h/Impl 8 | private: 9 | void setupSceneVBO() 10 | { 11 | // Do nothing for an empty scene. 12 | if (!this->scene.valid()) 13 | { 14 | return; 15 | } 16 | // Use VBO and EBO instead of display lists. 17 | // CRITICAL for: 18 | // * mobile 19 | // * web (Emscripten) to skip FULL_ES2 emulation flag 20 | render::VBOSetupVisitor vbo; 21 | this->scene->accept(vbo); 22 | } 23 | -------------------------------------------------------------------------------- /features/main/Example.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Setup 2 | struct Example 3 | { 4 | Application *app; 5 | 6 | typedef std::map Parameters; 7 | 8 | Example(const Parameters ¶meters) 9 | { 10 | this->app = new Application(EXAMPLE_TITLE); 11 | 12 | FEATURE main.h/TearDown 13 | } 14 | ~Example() 15 | { 16 | 17 | FEATURE main.h/Impl 18 | delete this->app; 19 | } 20 | 21 | FEATURE main.h/End 22 | }; 23 | -------------------------------------------------------------------------------- /features/main/MAIN_APPLICATION_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define MAIN_APPLICATION_LOG_PREFIX "main::Application(%p) %s" 5 | #define MAIN_APPLICATION_LOG(...) \ 6 | log::logprintf( \ 7 | MAIN_APPLICATION_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | -------------------------------------------------------------------------------- /features/main/MAIN_EXAMPLE_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define MAIN_EXAMPLE_LOG_PREFIX "main::Example(%p) %s" 5 | #define MAIN_EXAMPLE_LOG(...) \ 6 | log::logprintf( \ 7 | MAIN_EXAMPLE_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | -------------------------------------------------------------------------------- /features/main/library+Ex01+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex01_library_ ## FUNC_NAME 4 | #define JNI_ARG JNIEnv *env, jobject /* this */ 5 | -------------------------------------------------------------------------------- /features/main/library+Ex02+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex02_library_ ## FUNC_NAME 4 | #define JNI_ARG JNIEnv *env, jobject /* this */ 5 | -------------------------------------------------------------------------------- /features/main/library+Ex03+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex03_library_ ## FUNC_NAME 4 | #define JNI_FUNC_ARRAY(FUNC_NAME) \ 5 | JNIEXPORT jobjectArray JNICALL Java_org_opengamestudio_ex03_library_ ## FUNC_NAME 6 | #define JNI_ARG JNIEnv *env, jobject /* this */ 7 | -------------------------------------------------------------------------------- /features/main/library+Ex04+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex04_library_ ## FUNC_NAME 4 | #define JNI_FUNC_ARRAY(FUNC_NAME) \ 5 | JNIEXPORT jobjectArray JNICALL Java_org_opengamestudio_ex04_library_ ## FUNC_NAME 6 | #define JNI_ARG JNIEnv *env, jobject /* this */ 7 | -------------------------------------------------------------------------------- /features/main/library+Ex05+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex05_library_ ## FUNC_NAME 4 | #define JNI_ARG JNIEnv *env, jobject /* this */ 5 | -------------------------------------------------------------------------------- /features/main/library+Ex06+JNI-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | #define JNI_FUNC(FUNC_NAME) \ 3 | JNIEXPORT void JNICALL Java_org_opengamestudio_ex06_library_ ## FUNC_NAME 4 | #define JNI_ARG JNIEnv *env, jobject /* this */ 5 | -------------------------------------------------------------------------------- /features/main/library+frame-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | // Rendering. 3 | JNI_FUNC(frame)(JNI_ARG) 4 | { 5 | example->app->frame(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /features/main/library+frame-ios.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.h/Impl 2 | // Rendering. 3 | void frame(); 4 | 5 | FEATURE library.cpp/Impl 6 | void frame() 7 | { 8 | example->app->frame(); 9 | } 10 | -------------------------------------------------------------------------------- /features/main/library+handleMousePress-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | // Handle mouse press and release events. 3 | JNI_FUNC(handleMousePress)(JNI_ARG, jboolean down, jfloat x, jfloat y) 4 | { 5 | example->app->handleMousePress(down == JNI_TRUE, x, y); 6 | } 7 | -------------------------------------------------------------------------------- /features/main/library+init-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | // Setup graphics context. 3 | JNI_FUNC(init)(JNI_ARG, jint width, jint height) 4 | { 5 | // Create example only once. 6 | // If we create example at stack, the instance might get initialized 7 | // before plugin readers/writers are available, which would break everything. 8 | if (!example) 9 | { 10 | main::Example::Parameters parameters; 11 | example = new main::Example(parameters); 12 | } 13 | return example->app->setupWindow(width, height); 14 | } 15 | -------------------------------------------------------------------------------- /features/main/library+init-ios.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.h/Decl 2 | // Forward declare UIView for Objective-C++ and C++. 3 | #ifdef __OBJC__ 4 | @class UIView; 5 | #else 6 | class UIView; 7 | #endif 8 | 9 | FEATURE library.h/Impl 10 | // Initialization. 11 | UIView *init(int width, int height, float scale, UIView *parentView); 12 | 13 | FEATURE library.cpp/Impl 14 | UIView *init(int width, int height, float scale, UIView *parentView) 15 | { 16 | // Create example only once. 17 | // If we create example at stack, the instance might get initialized 18 | // before plugin readers/writers are available, which would break everything. 19 | if (!example) 20 | { 21 | main::Example::Parameters parameters; 22 | example = new main::Example(parameters); 23 | } 24 | return example->app->setupWindow(width, height, scale, parentView); 25 | } 26 | -------------------------------------------------------------------------------- /features/main/library+jniStrings-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Impl 2 | // Convert C++ strings to JNI ones. 3 | jobjectArray jniStrings(JNIEnv *env, const std::vector items) 4 | { 5 | // NOTE According to https://stackoverflow.com/questions/6238785/newstringutf-and-freeing-memory 6 | // NOTE we don't need to free memory of New* calls because these are Java's local references. 7 | // NOTE Since we pass them to Java (later), we don't need to do anything about them. 8 | jclass stringType = env->FindClass("java/lang/String"); 9 | jobjectArray result = env->NewObjectArray(items.size(), stringType, 0); 10 | int id = 0; 11 | for (auto item : items) 12 | { 13 | jstring jniItem = env->NewStringUTF(item.c_str()); 14 | env->SetObjectArrayElement(result, id++, jniItem); 15 | } 16 | return result; 17 | } 18 | -------------------------------------------------------------------------------- /features/main/library-android.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Include 2 | #include 3 | 4 | FEATURE library.cpp/NamespaceStart 5 | extern "C" { 6 | 7 | FEATURE library.cpp/NamespaceEnd 8 | } // extern "C". 9 | 10 | -------------------------------------------------------------------------------- /features/main/library-ios.cpp: -------------------------------------------------------------------------------- 1 | FEATURE library.cpp/Include 2 | #include "library.h" 3 | 4 | FEATURE library.cpp/NamespaceStart 5 | namespace library 6 | { 7 | 8 | FEATURE library.cpp/NamespaceEnd 9 | } // namespace library. 10 | -------------------------------------------------------------------------------- /features/main/main+Arguments-desktop.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Impl 2 | parameters = format::commandLineArgumentsToParameters(argc, argv); 3 | -------------------------------------------------------------------------------- /features/main/main+Arguments-web.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Impl 2 | parameters = format::urlQueryToParameters(argc, argv); 3 | -------------------------------------------------------------------------------- /features/main/main+Input-web.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Loop 2 | example->app->handleEvent(e); 3 | -------------------------------------------------------------------------------- /features/main/main+WindowResizing-web.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Setup 2 | example->app->resizeWindowToCanvasSize(); 3 | -------------------------------------------------------------------------------- /features/main/main-desktop.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Include 2 | #include "main.h" 3 | 4 | FEATURE main.cpp/Setup 5 | main::Example::Parameters parameters; 6 | 7 | FEATURE main.cpp/End 8 | auto example = new main::Example(parameters); 9 | example->app->setupWindow(main::EXAMPLE_TITLE, 100, 100, 480, 320); 10 | 11 | FEATURE main.cpp/Run 12 | example->app->run(); 13 | delete example; 14 | -------------------------------------------------------------------------------- /features/main/main-web.cpp: -------------------------------------------------------------------------------- 1 | FEATURE main.cpp/Include 2 | #include "main.h" 3 | #include 4 | #include 5 | 6 | FEATURE main.cpp/LoopBegin 7 | // Declare global example to be used by free functions. 8 | main::Example *example = 0; 9 | 10 | // Stand alone function that is called by Emscripten to run the app. 11 | void loop() 12 | { 13 | if (example) 14 | { 15 | SDL_Event e; 16 | while (SDL_PollEvent(&e)) 17 | { 18 | 19 | FEATURE main.cpp/LoopEnd 20 | } 21 | example->app->frame(); 22 | } 23 | } 24 | 25 | FEATURE main.cpp/Setup 26 | // Make sure SDL is working. 27 | if (SDL_Init(SDL_INIT_VIDEO) < 0) 28 | { 29 | printf("ERROR Could not initialize SDL: '%s'\n", SDL_GetError()); 30 | return 1; 31 | } 32 | // Clean SDL up at exit. 33 | atexit(SDL_Quit); 34 | 35 | main::Example::Parameters parameters; 36 | 37 | FEATURE main.cpp/End 38 | example = new main::Example(parameters); 39 | // Create rendering window of initial size. 40 | if (!example->app->setupWindow(main::EXAMPLE_TITLE, 800, 600)) 41 | { 42 | return 1; 43 | } 44 | 45 | FEATURE main.cpp/Run 46 | // Render asynchronously. 47 | emscripten_set_main_loop(loop, -1, 0); 48 | -------------------------------------------------------------------------------- /features/network/HTTPRequest.cpp: -------------------------------------------------------------------------------- 1 | FEATURE network.h/Include 2 | #include 3 | #include 4 | 5 | FEATURE network.h/Impl 6 | //! HTTP request container 7 | class HTTPRequest 8 | { 9 | public: 10 | typedef std::function Callback; 11 | 12 | enum STATUS 13 | { 14 | PENDING, 15 | IN_PROGRESS, 16 | COMPLETED 17 | }; 18 | 19 | // If data is emtpy, GET request is issued. 20 | // Otherwise POST request is issued. 21 | HTTPRequest( 22 | const std::string &url, 23 | const std::string &data, 24 | Callback success, 25 | Callback failure 26 | ) : 27 | url(url), 28 | data(data), 29 | success(success), 30 | failure(failure), 31 | status(PENDING) 32 | { } 33 | 34 | const std::string url; 35 | const std::string data; 36 | Callback success; 37 | Callback failure; 38 | STATUS status; 39 | }; 40 | -------------------------------------------------------------------------------- /features/network/fetch.cpp: -------------------------------------------------------------------------------- 1 | FEATURE network.h/Include 2 | #include 3 | -------------------------------------------------------------------------------- /features/network/mongoose.cpp: -------------------------------------------------------------------------------- 1 | FEATURE network.h/Include 2 | #include 3 | -------------------------------------------------------------------------------- /features/render/VBOSetupVisitor.cpp: -------------------------------------------------------------------------------- 1 | FEATURE render.h/Include 2 | #include 3 | #include 4 | #include 5 | 6 | FEATURE render.h/Impl 7 | //! This class forces the use of VBO. 8 | class VBOSetupVisitor : public osg::NodeVisitor 9 | { 10 | public: 11 | VBOSetupVisitor() : 12 | osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { } 13 | 14 | virtual void apply(osg::Geode &geode) 15 | { 16 | for (auto i = 0; i < geode.getNumDrawables(); ++i) 17 | { 18 | osg::Geometry *geom = 19 | dynamic_cast(geode.getDrawable(i)); 20 | if (geom) 21 | { 22 | geom->setUseVertexBufferObjects(true); 23 | } 24 | } 25 | NodeVisitor::apply(geode); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /features/render/createGraphicsContext-desktop.cpp: -------------------------------------------------------------------------------- 1 | FEATURE render.h/Impl 2 | // Create graphics context for Linux, macOS, Windows. 3 | osg::GraphicsContext *createGraphicsContext( 4 | const std::string &title, 5 | int x, 6 | int y, 7 | int width, 8 | int height) 9 | { 10 | // Traits is a struct to combine necessary parameters. 11 | osg::GraphicsContext::Traits *traits = 12 | new osg::GraphicsContext::Traits; 13 | // Geometry. 14 | traits->x = x; 15 | traits->y = y; 16 | traits->width = width; 17 | traits->height = height; 18 | // Title. 19 | traits->windowName = title; 20 | // Window borders. 21 | traits->windowDecoration = true; 22 | // Double buffer (simply put, it's a flicker fix). 23 | traits->doubleBuffer = true; 24 | // Create GC. 25 | return osg::GraphicsContext::createGraphicsContext(traits); 26 | } 27 | -------------------------------------------------------------------------------- /features/render/createGraphicsContext-ios.cpp: -------------------------------------------------------------------------------- 1 | FEATURE render.h/Include 2 | #include 3 | 4 | FEATURE render.h/Impl 5 | // Create graphics context for iOS. 6 | osg::GraphicsContext *createGraphicsContext( 7 | int width, 8 | int height, 9 | float scale, 10 | UIView *parentView 11 | ) { 12 | // Traits is a struct to combine necessary parameters. 13 | osg::GraphicsContext::Traits *traits = 14 | new osg::GraphicsContext::Traits; 15 | // Geometry. 16 | traits->x = 0; 17 | traits->y = 0; 18 | traits->width = width * scale; 19 | traits->height = height * scale; 20 | // Double buffer (simply put, it's a flicker fix). 21 | traits->doubleBuffer = true; 22 | // Parent view. 23 | osg::ref_ptr dat = 24 | new osgViewer::GraphicsWindowIOS::WindowData( 25 | parentView, 26 | 0, 27 | osgViewer::GraphicsWindowIOS::WindowData::IGNORE_ORIENTATION 28 | ); 29 | dat->setViewContentScaleFactor(scale); 30 | traits->inheritedWindowData = dat; 31 | // Create GC. 32 | return osg::GraphicsContext::createGraphicsContext(traits); 33 | } 34 | -------------------------------------------------------------------------------- /features/render/createShaderProgram.cpp: -------------------------------------------------------------------------------- 1 | FEATURE render.h/Include 2 | #include 3 | 4 | FEATURE render.h/Impl 5 | osg::Program *createShaderProgram( 6 | const std::string &vertexShader, 7 | const std::string &fragmentShader 8 | ) { 9 | // Load shaders. 10 | osg::Shader *vs = new osg::Shader(osg::Shader::VERTEX, vertexShader); 11 | osg::Shader *fs = new osg::Shader(osg::Shader::FRAGMENT, fragmentShader); 12 | // Compile shaders and compose shader program. 13 | osg::ref_ptr prog = new osg::Program; 14 | prog->addShader(vs); 15 | prog->addShader(fs); 16 | return prog.release(); 17 | } 18 | -------------------------------------------------------------------------------- /features/render/setupCamera.cpp: -------------------------------------------------------------------------------- 1 | FEATURE render.h/Include 2 | #include 3 | 4 | FEATURE render.h/Impl 5 | // Configure camera with common defaults. 6 | void setupCamera( 7 | osg::Camera *cam, 8 | osg::GraphicsContext *gc, 9 | double fovy, 10 | int width, 11 | int height 12 | ) { 13 | // Provide GC. 14 | cam->setGraphicsContext(gc); 15 | // Viewport must have the same size. 16 | cam->setViewport(new osg::Viewport(0, 0, width, height)); 17 | // Clear depth and color buffers each frame. 18 | cam->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 19 | // Aspect ratio. 20 | float aspect = static_cast(width) / static_cast(height); 21 | // Configure projection. 22 | cam->setProjectionMatrixAsPerspective(fovy, aspect, 1, 1000); 23 | } 24 | -------------------------------------------------------------------------------- /features/resource/Pool.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | class Pool 3 | { 4 | public: 5 | Pool() { } 6 | 7 | std::vector resources; 8 | 9 | void addResource(Resource &resource) 10 | { 11 | this->resources.push_back(resource); 12 | } 13 | 14 | Resource *resource(const std::string &group, const std::string &name) 15 | { 16 | auto count = this->resources.size(); 17 | for (int i = 0; i < count; ++i) 18 | { 19 | Resource *res = &this->resources[i]; 20 | if ( 21 | (res->group == group) && 22 | (res->name == name) 23 | ) { 24 | return res; 25 | } 26 | } 27 | 28 | return 0; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /features/resource/RESOURCE_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define RESOURCE_LOG_PREFIX "resource %s" 5 | #define RESOURCE_LOG(...) \ 6 | log::logprintf( \ 7 | RESOURCE_LOG_PREFIX, \ 8 | format::printfString(__VA_ARGS__).c_str() \ 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /features/resource/RESOURCE_POOL_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define RESOURCE_POOL_LOG_PREFIX "resource::Pool(%p) %s" 5 | #define RESOURCE_POOL_LOG(...) \ 6 | log::logprintf( \ 7 | RESOURCE_POOL_LOG_PREFIX, \ 8 | this, \ 9 | format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | -------------------------------------------------------------------------------- /features/resource/Resource.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | //! Resource container. 3 | struct Resource 4 | { 5 | Resource( 6 | const std::string &group, 7 | const std::string &name, 8 | unsigned char *contents, 9 | unsigned int len 10 | ) : 11 | group(group), 12 | name(name), 13 | contents(contents), 14 | len(len) 15 | { } 16 | 17 | std::string group; 18 | std::string name; 19 | unsigned char *contents; 20 | unsigned int len; 21 | }; 22 | -------------------------------------------------------------------------------- /features/resource/createTexture.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Include 2 | #include 3 | 4 | FEATURE resource.h/Impl 5 | //! Create texture from a resource. 6 | osg::Texture2D *createTexture(const Resource &resource) 7 | { 8 | osg::ref_ptr tex = new osg::Texture2D; 9 | setTextureImage(tex, resource); 10 | tex->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT); 11 | tex->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT); 12 | tex->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR); 13 | tex->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 14 | return tex.release(); 15 | } 16 | -------------------------------------------------------------------------------- /features/resource/extension.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | std::string extension(const Resource &resource) 3 | { 4 | auto dotPosition = resource.name.rfind("."); 5 | // Return empty extension if we cannot detect it. 6 | if (dotPosition == std::string::npos) 7 | { 8 | RESOURCE_LOG( 9 | "ERROR Could not detect file extension for '%s/%s' resource", 10 | resource.group.c_str(), 11 | resource.name.c_str() 12 | ); 13 | return ""; 14 | } 15 | return resource.name.substr(dotPosition + 1); 16 | } 17 | -------------------------------------------------------------------------------- /features/resource/string.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | std::string string(const Resource &resource) 3 | { 4 | const char *contents = reinterpret_cast(resource.contents); 5 | return std::string(contents, resource.len); 6 | } 7 | -------------------------------------------------------------------------------- /features/resource/stringToResourceContents.cpp: -------------------------------------------------------------------------------- 1 | FEATURE resource.h/Impl 2 | unsigned char * stringToResourceContents(const std::string &str) 3 | { 4 | auto dat = const_cast(str.data()); 5 | if (!dat) 6 | { 7 | RESOURCE_LOG( 8 | "ERROR Could not convert string to resource contents " 9 | "at 'const char * -> char *' stage" 10 | ); 11 | return 0; 12 | } 13 | auto contents = reinterpret_cast(dat); 14 | if (!contents) 15 | { 16 | RESOURCE_LOG( 17 | "ERROR Could not convert string to resource contents " 18 | "at 'char * -> usigned char *' stage" 19 | ); 20 | return 0; 21 | } 22 | 23 | return contents; 24 | } 25 | -------------------------------------------------------------------------------- /features/scene/OSGCPE_SCENE_LINEAR_INTERPOLATOR_LOG.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | #include "log.h" 3 | #include "format.h" 4 | #define OSGCPE_SCENE_LINEAR_INTERPOLATOR_LOG_PREFIX "osgcpe::scene::LinearInterpolator(%p) %s" 5 | #define OSGCPE_SCENE_LINEAR_INTERPOLATOR_LOG(...) \ 6 | osgcpe::log::logprintf( \ 7 | OSGCPE_SCENE_LINEAR_INTERPOLATOR_LOG_PREFIX, \ 8 | this, \ 9 | osgcpe::format::printfString(__VA_ARGS__).c_str() \ 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /features/scene/createBox.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | osg::MatrixTransform *createBox(const osg::Vec3f &size) 3 | { 4 | auto box = new osg::Box(osg::Vec3f(0, 0, 0), size.x(), size.y(), size.z()); 5 | return createShape(box); 6 | } 7 | osg::MatrixTransform *createBox(float size) 8 | { 9 | return createBox(osg::Vec3f(size, size, size)); 10 | } 11 | -------------------------------------------------------------------------------- /features/scene/createShape.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Include 2 | #include 3 | #include 4 | #include 5 | 6 | FEATURE scene.h/Impl 7 | osg::MatrixTransform *createShape(osg::Shape *shape) 8 | { 9 | auto hints = new osg::TessellationHints; 10 | hints->setDetailRatio(0.5); 11 | auto geode = new osg::Geode(); 12 | geode->addDrawable(new osg::ShapeDrawable(shape, hints)); 13 | osg::ref_ptr node = new osg::MatrixTransform; 14 | node->addChild(geode); 15 | return node.release(); 16 | } 17 | -------------------------------------------------------------------------------- /features/scene/createSphere.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | osg::MatrixTransform *createSphere(float radius) 3 | { 4 | auto sphere = new osg::Sphere(osg::Vec3f(0, 0, 0), radius); 5 | return createShape(sphere); 6 | } 7 | -------------------------------------------------------------------------------- /features/scene/degreesToQuaternion.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | //! Convert from degrees to quaternion. 3 | osg::Quat degreesToQuaternion(const osg::Vec3f °rees) 4 | { 5 | osg::Quat q; 6 | q.makeRotate( 7 | osg::DegreesToRadians(degrees.x()), osg::Vec3(1, 0, 0), 8 | osg::DegreesToRadians(degrees.y()), osg::Vec3(0, 1, 0), 9 | osg::DegreesToRadians(degrees.z()), osg::Vec3(0, 0, 1) 10 | ); 11 | return q; 12 | } 13 | -------------------------------------------------------------------------------- /features/scene/nodeAtPosition.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | //! Pick node at the specified position using camera's point of view 3 | 4 | // \param excludedNodeMask Take the node into consideration if it excludes specified mask. 5 | osg::Node *nodeAtPosition( 6 | const osg::Vec2f &position, 7 | osg::Camera *camera, 8 | unsigned int excludedNodeMask 9 | ) { 10 | // Find intersections. 11 | osg::ref_ptr intersector = 12 | new osgUtil::LineSegmentIntersector( 13 | osgUtil::Intersector::WINDOW, 14 | position.x(), 15 | position.y() 16 | ); 17 | osgUtil::IntersectionVisitor iv(intersector.get()); 18 | camera->accept(iv); 19 | 20 | // No intersections found. 21 | if (!intersector->containsIntersections()) 22 | { 23 | return 0; 24 | } 25 | 26 | // Get closest intersection. 27 | auto intersection = intersector->getFirstIntersection(); 28 | for (auto node : intersection.nodePath) 29 | { 30 | // Make sure node mask is excluded. 31 | if ((node->getNodeMask() & excludedNodeMask) != excludedNodeMask) 32 | { 33 | return node; 34 | } 35 | } 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /features/scene/paintScene.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | void paintScene(osg::Node *scene) 3 | { 4 | // Fragment shader to display everything in red colour. 5 | const char shaderFragment[] = "void main() { gl_FragColor = vec4(0.5, 0.3, 0.3, 1.0); }"; 6 | // Vertex shader to pass geometry vertices to fragment shader. 7 | const char shaderVertex[] = "void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }"; 8 | auto prog = render::createShaderProgram(shaderVertex, shaderFragment); 9 | scene->getOrCreateStateSet()->setAttribute(prog); 10 | } 11 | -------------------------------------------------------------------------------- /features/scene/quaternionToDegrees.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | osg::Vec3f quaternionToDegrees(const osg::Quat &quaternion) 3 | { 4 | double q0 = quaternion.x(); 5 | double q1 = quaternion.y(); 6 | double q2 = quaternion.z(); 7 | double q3 = quaternion.w(); 8 | 9 | //double sq0 = q0 * q0; 10 | double sq1 = q1 * q1; 11 | double sq2 = q2 * q2; 12 | double sq3 = q3 * q3; 13 | 14 | double term1 = 2*(q0*q1 + q2*q3); 15 | double term2 = 1 - 2 * (sq1 + sq2); 16 | double term3 = 2 * (q0*q2 - q3*q1); 17 | double term4 = 2 * (q0*q3 + q1*q2); 18 | double term5 = 1 - 2 * (sq2 + sq3); 19 | 20 | double z = atan2(term1, term2); 21 | double y = asin(term3); 22 | double x = atan2(term4, term5); 23 | 24 | osg::Vec3f result(x * 180.0 / M_PI, y * 180.0 / M_PI, z * 180.0 / M_PI); 25 | // Fix for X when Y = 0. 26 | result.x() = 180 - result.x(); 27 | // Fix for Z when Y = 0. 28 | if (result.z() < 0) 29 | { 30 | result.z() = 360 + result.z(); 31 | } 32 | return result; 33 | } 34 | -------------------------------------------------------------------------------- /features/scene/setSimplePosition.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Include 2 | #include 3 | 4 | FEATURE scene.h/Impl 5 | //! Set node position. 6 | //! NOTE Only works for non-rotated/scaled nodes. 7 | void setSimplePosition(osg::MatrixTransform *node, const osg::Vec3f &position) 8 | { 9 | auto matrix = node->getMatrix(); 10 | node->setMatrix( 11 | osg::Matrix::scale(matrix.getScale()) * 12 | osg::Matrix::rotate(matrix.getRotate()) * 13 | osg::Matrix::translate(position) 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /features/scene/setSimpleRotation.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Impl 2 | //! Set node rotation. 3 | void setSimpleRotation(osg::MatrixTransform *node, const osg::Vec3f &rotation) 4 | { 5 | osg::Quat quat = degreesToQuaternion(rotation); 6 | node->setMatrix( 7 | osg::Matrix::scale(node->getMatrix().getScale()) * 8 | osg::Matrix::rotate(quat) * 9 | osg::Matrix::translate(node->getMatrix().getTrans()) 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /features/scene/simplePosition.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Include 2 | #include 3 | 4 | FEATURE scene.h/Impl 5 | //! Get node position. 6 | //! NOTE Only works for non-rotated/scaled nodes. 7 | osg::Vec3f simplePosition(osg::MatrixTransform *node) 8 | { 9 | return node->getMatrix().getTrans(); 10 | } 11 | -------------------------------------------------------------------------------- /features/scene/simpleRotation.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Include 2 | #include 3 | 4 | FEATURE scene.h/Impl 5 | //! Get node rotation. 6 | osg::Vec3f simpleRotation(osg::MatrixTransform *node) 7 | { 8 | auto quat = node->getMatrix().getRotate(); 9 | return quaternionToDegrees(quat); 10 | } 11 | -------------------------------------------------------------------------------- /features/scene/textureImageScene.cpp: -------------------------------------------------------------------------------- 1 | FEATURE scene.h/Include 2 | #include "render.h" 3 | #include "resource.h" 4 | 5 | FEATURE scene.h/Impl 6 | void textureImageScene( 7 | osg::Node *scene, 8 | const resource::Resource &shaderFrag, 9 | const resource::Resource &shaderVert, 10 | const resource::Resource &textureImage 11 | ) { 12 | // Create shader program. 13 | auto prog = 14 | render::createShaderProgram( 15 | resource::string(shaderVert), 16 | resource::string(shaderFrag) 17 | ); 18 | // Apply the program. 19 | auto material = scene->getOrCreateStateSet(); 20 | material->setAttribute(prog); 21 | // Set texture image. 22 | material->setTextureAttributeAndModes(0, resource::createTexture(textureImage)); 23 | material->addUniform(new osg::Uniform("image", 0)); 24 | } 25 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/include/ios/gen/gen.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | void printAnything() 5 | { 6 | printf("printAnything in action\n"); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/include/web/gen/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main() 5 | { 6 | printf("This example exists just to get OpenSceneGraph's generated files\n"); 7 | 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/OpenThreads.mm: -------------------------------------------------------------------------------- 1 | #include "src/OpenThreads.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osg-01.mm: -------------------------------------------------------------------------------- 1 | #include "src/osg-01.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osg-02.mm: -------------------------------------------------------------------------------- 1 | #include "src/osg-02.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osg-03.mm: -------------------------------------------------------------------------------- 1 | #include "src/osg-03.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgDB.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgDB.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgGA.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgGA.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgUtil.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgUtil.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgViewer.mm: -------------------------------------------------------------------------------- 1 | 2 | #define USE_IOS_IMPLEMENTATION 3 | 4 | #include "src/osgViewer/GraphicsWindowIOS.mm" 5 | #include "src/osgViewer/IOSUtils.mm" 6 | 7 | #include "src/osgViewer.cpp" 8 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_imageio.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_imageio.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_osg.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_osg.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Drawable.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Drawable.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Geode.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Geode.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Geometry.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Geometry.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Group.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Group.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-LibraryWrapper.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-LibraryWrapper.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-MatrixTransform.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-MatrixTransform.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Node.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Node.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Object.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Object.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src-ios/osgdb_serializers_osg-Transform.mm: -------------------------------------------------------------------------------- 1 | #include "src/osgdb_serializers_osg-Transform.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/OpenThreads.cpp: -------------------------------------------------------------------------------- 1 | #include "src/OpenThreads/common/Atomic.cpp" 2 | #include "src/OpenThreads/common/Version.cpp" 3 | 4 | #include "src/OpenThreads/pthreads/PThread.cpp" 5 | #include "src/OpenThreads/pthreads/PThreadBarrier.cpp" 6 | #include "src/OpenThreads/pthreads/PThreadCondition.cpp" 7 | #include "src/OpenThreads/pthreads/PThreadMutex.cpp" 8 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osg-02.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osg/glu/libtess/mesh.cpp" 2 | #include "src/osg/glu/libtess/priorityq.cpp" 3 | #include "src/osg/Matrixd.cpp" 4 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osg-03.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osg/Quat.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgDB.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgDB/Archive.cpp" 2 | #include "src/osgDB/ConvertBase64.cpp" 3 | #include "src/osgDB/DatabasePager.cpp" 4 | #include "src/osgDB/DatabaseRevisions.cpp" 5 | #include "src/osgDB/DynamicLibrary.cpp" 6 | #include "src/osgDB/FileCache.cpp" 7 | #include "src/osgDB/FileNameUtils.cpp" 8 | #include "src/osgDB/FileUtils.cpp" 9 | #include "src/osgDB/fstream.cpp" 10 | #include "src/osgDB/ImagePager.cpp" 11 | #include "src/osgDB/InputStream.cpp" 12 | #include "src/osgDB/MimeTypes.cpp" 13 | #include "src/osgDB/ObjectCache.cpp" 14 | #include "src/osgDB/ObjectWrapper.cpp" 15 | #include "src/osgDB/Options.cpp" 16 | #include "src/osgDB/OutputStream.cpp" 17 | #include "src/osgDB/Registry.cpp" 18 | #include "src/osgDB/ReaderWriter.cpp" 19 | #include "src/osgDB/ReadFile.cpp" 20 | #include "src/osgDB/SharedStateManager.cpp" 21 | #include "src/osgDB/StreamOperator.cpp" 22 | #include "src/osgDB/XmlParser.cpp" 23 | #include "src/osgDB/WriteFile.cpp" 24 | 25 | // For plugins. 26 | #include "src/osgDB/DotOsgWrapper.cpp" 27 | #include "src/osgDB/Input.cpp" 28 | #include "src/osgDB/Output.cpp" 29 | #include "src/osgDB/Field.cpp" 30 | #include "src/osgDB/FieldReader.cpp" 31 | #include "src/osgDB/FieldReaderIterator.cpp" 32 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgDB.mm: -------------------------------------------------------------------------------- 1 | #include "osgDB.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgGA.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgGA/CameraManipulator.cpp" 2 | #include "src/osgGA/Event.cpp" 3 | #include "src/osgGA/EventHandler.cpp" 4 | #include "src/osgGA/EventQueue.cpp" 5 | #include "src/osgGA/EventVisitor.cpp" 6 | #include "src/osgGA/GUIEventAdapter.cpp" 7 | #include "src/osgGA/GUIEventHandler.cpp" 8 | #include "src/osgGA/OrbitManipulator.cpp" 9 | #include "src/osgGA/StandardManipulator.cpp" 10 | #include "src/osgGA/TrackballManipulator.cpp" 11 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgUtil.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgUtil/CullVisitor.cpp" 2 | #include "src/osgUtil/GLObjectsVisitor.cpp" 3 | #include "src/osgUtil/IncrementalCompileOperation.cpp" 4 | #include "src/osgUtil/IntersectionVisitor.cpp" 5 | #include "src/osgUtil/LineSegmentIntersector.cpp" 6 | #include "src/osgUtil/MeshOptimizers.cpp" 7 | #include "src/osgUtil/Optimizer.cpp" 8 | #include "src/osgUtil/PositionalStateContainer.cpp" 9 | #include "src/osgUtil/RayIntersector.cpp" 10 | #include "src/osgUtil/RenderBin.cpp" 11 | #include "src/osgUtil/RenderLeaf.cpp" 12 | #include "src/osgUtil/RenderStage.cpp" 13 | #include "src/osgUtil/SceneView.cpp" 14 | #include "src/osgUtil/StateGraph.cpp" 15 | #include "src/osgUtil/Statistics.cpp" 16 | #include "src/osgUtil/Tessellator.cpp" 17 | #include "src/osgUtil/TransformAttributeFunctor.cpp" 18 | #include "src/osgUtil/UpdateVisitor.cpp" 19 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgViewer-linux.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgViewer/GraphicsWindowX11.cpp" 2 | #include "src/osgViewer/PixelBufferX11.cpp" 3 | 4 | #include "osgViewer.cpp" 5 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgViewer-macos.mm: -------------------------------------------------------------------------------- 1 | 2 | #define USE_DARWIN_COCOA_IMPLEMENTATION 3 | 4 | #include "src/osgViewer/DarwinUtils.mm" 5 | #include "src/osgViewer/GraphicsWindowCocoa.mm" 6 | #include "src/osgViewer/PixelBufferCocoa.mm" 7 | 8 | #include "osgViewer.cpp" 9 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgViewer.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgViewer/CompositeViewer.cpp" 2 | #include "src/osgViewer/GraphicsWindow.cpp" 3 | #include "src/osgViewer/Keystone.cpp" 4 | #include "src/osgViewer/Renderer.cpp" 5 | #include "src/osgViewer/Scene.cpp" 6 | #include "src/osgViewer/View.cpp" 7 | #include "src/osgViewer/ViewerBase.cpp" 8 | #include "src/osgViewer/Viewer.cpp" 9 | #include "src/osgViewer/config/AcrossAllScreens.cpp" 10 | #include "src/osgViewer/config/SingleScreen.cpp" 11 | #include "src/osgViewer/config/SingleWindow.cpp" 12 | #include "src/osgViewer/config/SphericalDisplay.cpp" 13 | #include "src/osgViewer/config/PanoramicSphericalDisplay.cpp" 14 | #include "src/osgViewer/config/WoWVxDisplay.cpp" 15 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_imageio.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgPlugins/imageio/ReaderWriterImageIO.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_osg.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgPlugins/osg/ReaderWriterOSG.cpp" 2 | #include "src/osgPlugins/osg/ReaderWriterOSG2.cpp" 3 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_png.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgPlugins/png/ReaderWriterPNG.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Drawable.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Drawable.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Geode.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Geode.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Geometry.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Geometry.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Group.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Group.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-LibraryWrapper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | USE_SERIALIZER_WRAPPER(Drawable) 4 | USE_SERIALIZER_WRAPPER(Geode) 5 | USE_SERIALIZER_WRAPPER(Geometry) 6 | USE_SERIALIZER_WRAPPER(Group) 7 | USE_SERIALIZER_WRAPPER(MatrixTransform) 8 | USE_SERIALIZER_WRAPPER(Node) 9 | USE_SERIALIZER_WRAPPER(Object) 10 | USE_SERIALIZER_WRAPPER(Transform) 11 | 12 | extern "C" void wrapper_serializer_library_osg(void) {} 13 | 14 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-MatrixTransform.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/MatrixTransform.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Node.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Node.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Object.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Object.cpp" 2 | -------------------------------------------------------------------------------- /libs/OpenSceneGraph/src/osgdb_serializers_osg-Transform.cpp: -------------------------------------------------------------------------------- 1 | #include "src/osgWrappers/serializers/osg/Transform.cpp" 2 | -------------------------------------------------------------------------------- /libs/json-android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(JSON_ANDROID) 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 3 | # Provide Android with missing STL functions. 4 | 5 | # NOTE Must be provided by parent. 6 | #SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 7 | 8 | # Reference NLohmann's JSON library. 9 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/../json) 10 | # Provide custom header for inclusion. 11 | INCLUDE_DIRECTORIES(${OSGCPE_DIR}/libs/json-android/include) 12 | -------------------------------------------------------------------------------- /libs/json-android/include/nlohmann/json.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Work around Android not having localeconv() before API 21. 3 | // We target API 14. 4 | #include 5 | 6 | lconv *localeconv() 7 | { 8 | static lconv lc; 9 | return &lc; 10 | } 11 | 12 | // Work around Android not having several STL functions in std. 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace std 19 | { 20 | using ::strtof; 21 | using ::strtold; 22 | using ::strtoll; 23 | using ::strtoull; 24 | using ::snprintf; 25 | 26 | template 27 | inline std::string to_string(T value) 28 | { 29 | std::ostringstream os; 30 | os << value; 31 | return os.str(); 32 | } 33 | 34 | inline int stoi(const std::string &s, size_t *idx = 0, int base = 10) 35 | { 36 | char *endptr = 0; 37 | int result = strtol(s.c_str(), &endptr, base); 38 | if (idx) 39 | { 40 | *idx = endptr - s.c_str(); 41 | } 42 | return result; 43 | } 44 | 45 | } // namespace std 46 | 47 | // Include NLohmann's JSON. 48 | #include 49 | 50 | -------------------------------------------------------------------------------- /libs/libpng-android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(STATIC_LIBPNG_ANDROID) 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 3 | # Build libpng-android into static library under Android. 4 | 5 | # NOTE Must be provided by parent. 6 | #SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../../openscenegraph-cross-platform-examples") 7 | 8 | # Path to libpng-android source. 9 | SET(PNG_SRC_DIR "${OSGCPE_DIR}/../libpng-android/jni") 10 | INCLUDE_DIRECTORIES(${PNG_SRC_DIR}) 11 | # Path to this directory with our libpng-android files. 12 | SET(PNG_DIR "${OSGCPE_DIR}/libs/libpng-android") 13 | 14 | # Libraries. 15 | SET(SRC "${PNG_DIR}/src") 16 | 17 | ADD_LIBRARY( 18 | png 19 | STATIC 20 | ${SRC}/libpng.cpp 21 | ${PNG_SRC_DIR}/arm/filter_neon.S 22 | ) 23 | TARGET_LINK_LIBRARIES(png z) 24 | -------------------------------------------------------------------------------- /libs/libpng-android/src/libpng.cpp: -------------------------------------------------------------------------------- 1 | #include "arm/arm_init.c" 2 | #include "arm/filter_neon_intrinsics.c" 3 | #include "png.c" 4 | #include "pngerror.c" 5 | #include "pngget.c" 6 | #include "pngmem.c" 7 | #include "pngpread.c" 8 | #include "pngread.c" 9 | #include "pngrio.c" 10 | #include "pngrtran.c" 11 | #include "pngrutil.c" 12 | #include "pngset.c" 13 | #include "pngtest.c" 14 | #include "pngtrans.c" 15 | #include "pngwio.c" 16 | #include "pngwrite.c" 17 | #include "pngwtran.c" 18 | #include "pngwutil.c" 19 | -------------------------------------------------------------------------------- /libs/mongoose/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(STATIC_MONGOOSE) 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 3 | # Build mongoose into static library. 4 | 5 | # Path to openscenegraph-cross-platform-examples. 6 | # NOTE Must by provided by parent. 7 | #SET(OSGCPE_DIR "${CMAKE_SOURCE_DIR}/../../../openscenegraph-cross-platform-examples") 8 | 9 | # Path to mongoose source. 10 | SET(MONGOOSE_SRC_DIR "${OSGCPE_DIR}/../mongoose") 11 | # Path to this directory with our mongoose files. 12 | SET(MONGOOSE "${OSGCPE_DIR}/libs/mongoose") 13 | 14 | # Reference mongoose. 15 | INCLUDE_DIRECTORIES(${MONGOOSE_SRC_DIR}) 16 | ADD_LIBRARY(mongoose STATIC ${MONGOOSE}/mongoose.cpp) 17 | TARGET_LINK_LIBRARIES( 18 | mongoose 19 | ssl 20 | crypto 21 | ) 22 | 23 | # Reference OpenSSL. 24 | SET(OPENSSL_INC_DIR "" CACHE PATH "Path to OpenSSL include directory") 25 | SET(OPENSSL_LIB_DIR "" CACHE PATH "Path to OpenSSL lib directory") 26 | INCLUDE_DIRECTORIES(${OPENSSL_INC_DIR}) 27 | LINK_DIRECTORIES(${OPENSSL_LIB_DIR}) 28 | # Use SSL. 29 | ADD_DEFINITIONS("-DMG_ENABLE_SSL=1") 30 | 31 | -------------------------------------------------------------------------------- /libs/mongoose/mongoose.cpp: -------------------------------------------------------------------------------- 1 | #include "mongoose.c" 2 | -------------------------------------------------------------------------------- /readme/shot-android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/readme/shot-android.png -------------------------------------------------------------------------------- /readme/shot-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/readme/shot-desktop.png -------------------------------------------------------------------------------- /readme/shot-ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/readme/shot-ios.png -------------------------------------------------------------------------------- /readme/shot-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGStudio/openscenegraph-cross-platform-examples/4a59b62139bebc022b6cc8e0043e898f92f01374/readme/shot-web.png -------------------------------------------------------------------------------- /tools/create-serializers: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Create osg_serializers_osg- files with contents 3 | 4 | CLASSES=" 5 | Drawable 6 | Geode 7 | Geometry 8 | Group 9 | Object 10 | MatrixTransform 11 | Node 12 | Transform 13 | " 14 | 15 | for class in $CLASSES; do 16 | fileName="osgdb_serializers_osg-$class.cpp" 17 | contents="#include \"src/osgWrappers/serializers/osg/$class.cpp\"" 18 | echo $fileName 19 | echo $contents > $fileName 20 | done 21 | 22 | -------------------------------------------------------------------------------- /tools/emscripten-arguments: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script patches JS file generated by Emscripten 4 | # to provide address bar query parameters as argv to main(). 5 | 6 | fileName=$1 7 | 8 | if [ -z "$fileName" ]; then 9 | echo "Usage: $0 FILE_NAME" 10 | exit 1 11 | fi 12 | 13 | # Replace 14 | # `Module["arguments"]=[]` 15 | # with 16 | # `Module["arguments"]=[window.location.search]` 17 | sed 's|Module\["arguments"\]=\[\]|Module\["arguments"\]=\[window.location.search.substr(1)\]|' $fileName 18 | -------------------------------------------------------------------------------- /tools/emscripten-fullpage: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script adds CSS style to #canvas to make it display full page. 4 | 5 | fileName=$1 6 | 7 | if [ -z "$fileName" ]; then 8 | echo "Usage: $0 FILE_NAME" 9 | exit 1 10 | fi 11 | 12 | # Create temporary directory for temporary files. 13 | MYTMPDIR=$(mktemp -d) 14 | # Remove temporary directory on exit. 15 | trap "rm -fR $MYTMPDIR" EXIT 16 | 17 | tmpFileNameA=$MYTMPDIR/emscripten-fullpage.tmp.a 18 | tmpFileNameB=$MYTMPDIR/emscripten-fullpage.tmp.b 19 | 20 | # 1. Replace '\n' to '\r' for sed to work easily. 21 | # Topic: How can I use sed to replace a multi-line string? 22 | # Source: https://unix.stackexchange.com/a/152389 23 | cat $fileName | tr '\n' '\r' > $tmpFileNameA 24 | 25 | style=" 26 | #canvas { 27 | position: absolute; 28 | top: 0px; 29 | left: 0px; 30 | margin: 0px; 31 | width: 100%; 32 | height: 100%; 33 | overflow: hidden; 34 | display: block; 35 | } 36 | " 37 | # 2. Compact the style into single line. 38 | compactStyle=$(echo $style | tr '\n' '\r') 39 | 40 | # 3. Add the style before `body` style. 41 | 42 | cat $tmpFileNameA | sed "s|body {|\n$compactStyle\nbody {|" > $tmpFileNameB 43 | 44 | # 4. Replace '\r' back to '\n'. 45 | cat $tmpFileNameB | tr '\r' '\n' 46 | -------------------------------------------------------------------------------- /tools/patch-openscenegraph: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Replace Billboard's square macro. 4 | fileName="src/osg/Billboard.cpp" 5 | echo "Patching '$fileName'" 6 | sed -i.bak 's|#define square.*||' $fileName 7 | --------------------------------------------------------------------------------