Merge remote-tracking branch 'upstream/master' into MDI7
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -27,7 +27,7 @@ CMakeFiles
|
||||
CMakeScripts
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
install_manifest*.txt
|
||||
|
||||
|
||||
# Compiled Object files
|
||||
@@ -84,3 +84,11 @@ DerivedData/
|
||||
*.DS_Store
|
||||
*.build
|
||||
*.xcodeproj
|
||||
|
||||
#CPACK related files
|
||||
CPackConfig-*.cmake
|
||||
_CPack_Packages/
|
||||
|
||||
#packages
|
||||
*.tar.gz
|
||||
*.zip
|
||||
|
||||
@@ -29,7 +29,7 @@ matrix:
|
||||
name: "openscenegraph/OpenSceneGraph"
|
||||
description: "OpenSceneGraph build"
|
||||
notification_email: robert@openscenegraph.com
|
||||
build_command_prepend: "cmake -DCMAKE_BUILD_TYPE=Release ."
|
||||
build_command_prepend: "cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_OSG_DEPRECATED_SERIALIZERS=OFF ."
|
||||
build_command: "make -j 3"
|
||||
branch_pattern: coverity_scan
|
||||
apt:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
OpenSceneGraph Library 3.5.6
|
||||
OpenSceneGraph Library 3.5.7
|
||||
|
||||
566 Contributors:
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ IF(APPLE AND NOT ANDROID)
|
||||
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
||||
ENDIF()
|
||||
|
||||
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
|
||||
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two separate projects
|
||||
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
||||
|
||||
ELSE()
|
||||
@@ -115,7 +115,7 @@ PROJECT(OpenSceneGraph)
|
||||
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 5)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 6)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 7)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 149)
|
||||
|
||||
# set to 0 when not a release candidate, non zero means that any generated
|
||||
@@ -232,7 +232,7 @@ IF(NOT ANDROID)
|
||||
IF(APPLE)
|
||||
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
|
||||
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
|
||||
# set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
|
||||
# set to true. Should really have an OSG_BUILD_PLATFORM variable that we set to our desired platform
|
||||
OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
|
||||
OPTION(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR "Enable IPhoneSDK Simulator support" OFF)
|
||||
|
||||
@@ -851,6 +851,17 @@ SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windo
|
||||
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
|
||||
SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")
|
||||
|
||||
# Correct any incorrect case usage in CMAKE_BUILD_TYPE
|
||||
IF (CMAKE_BUILD_TYPE MATCHES "release" OR CMAKE_BUILD_TYPE MATCHES "RELEASE")
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
ELSEIF (CMAKE_BUILD_TYPE MATCHES "minsizerel" OR CMAKE_BUILD_TYPE MATCHES "MINSIZEREL")
|
||||
SET(CMAKE_BUILD_TYPE "MinSizeRel")
|
||||
ELSEIF (CMAKE_BUILD_TYPE MATCHES "relwithdebinfo" OR CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO")
|
||||
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
ELSEIF (CMAKE_BUILD_TYPE MATCHES "debug" OR CMAKE_BUILD_TYPE MATCHES "DEBUG")
|
||||
SET(CMAKE_BUILD_TYPE "Debug")
|
||||
ENDIF()
|
||||
|
||||
# Set the build postfix extension according to what configuration is being built.
|
||||
IF (CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
SET(CMAKE_BUILD_POSTFIX "${CMAKE_RELEASE_POSTFIX}")
|
||||
@@ -884,7 +895,7 @@ IF(NOT DEFINED LIB_POSTFIX)
|
||||
SET(LIB_POSTFIX "")
|
||||
ENDIF()
|
||||
|
||||
# Here we apparantly do some funky stuff with making the bin/ and lib/
|
||||
# Here we apparently do some funky stuff with making the bin/ and lib/
|
||||
# folders which is probably needed to work around a very old CMake bug?
|
||||
|
||||
#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
|
||||
@@ -1057,7 +1068,7 @@ IF(OSG_AGGRESSIVE_WARNING_FLAGS)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
# Remove all flags considered aggresive
|
||||
# Remove all flags considered aggressive
|
||||
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
|
||||
STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
ENDFOREACH()
|
||||
@@ -1112,7 +1123,7 @@ IF(APPLE AND NOT ANDROID)
|
||||
|
||||
ENDIF()
|
||||
|
||||
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
|
||||
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two separate projects
|
||||
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
||||
|
||||
#hack, force link to opengles
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
|
||||
#In OSG ffmpeg plugin, we used "#include <header.h>" for compatibility with old version of ffmpeg
|
||||
#With the new version of FFmpeg, a file named "time.h" was added that breaks compatability with the old version of ffmpeg.
|
||||
#With the new version of FFmpeg, a file named "time.h" was added that breaks compatibility with the old version of ffmpeg.
|
||||
|
||||
#We have to search the path which contain the header.h (useful for old version)
|
||||
#and search the path which contain the libname/header.h (useful for new version)
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Locate zlib
|
||||
# This module defines
|
||||
# ZLIB_LIBRARY
|
||||
# ZLIB_FOUND, if false, do not try to link to zlib
|
||||
# ZLIB_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# $ZLIB_DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$ZLIB_DIR
|
||||
# used in building zlib.
|
||||
#
|
||||
# Created by Ulrich Hertlein.
|
||||
|
||||
# prefer FindZLIB from cmake distribution
|
||||
if(EXISTS ${CMAKE_ROOT}/Modules/FindZLIB.cmake)
|
||||
include(${CMAKE_ROOT}/Modules/FindZLIB.cmake)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
|
||||
$ENV{ZLIB_DIR}/include
|
||||
$ENV{ZLIB_DIR}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/sw/include # Fink
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(ZLIB_LIBRARY
|
||||
NAMES z libz zlib
|
||||
PATHS
|
||||
$ENV{ZLIB_DIR}/lib
|
||||
$ENV{ZLIB_DIR}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
SET(ZLIB_FOUND "NO")
|
||||
IF(ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
|
||||
SET(ZLIB_FOUND "YES")
|
||||
ENDIF(ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ MACRO(GENERATE_PACKAGING_TARGET package_name)
|
||||
COMMENT "Run CPack packaging for ${package_name}..."
|
||||
)
|
||||
# Add the exact same custom command to the all package generating target.
|
||||
# I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here
|
||||
# I can't use add_dependencies to do this because it would allow parallel building of packages so am going brute here
|
||||
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME}
|
||||
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
|
||||
)
|
||||
|
||||
@@ -44,7 +44,7 @@ MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
|
||||
ENDIF(${varname}_RELEASE)
|
||||
ELSE(${varname}_DEBUG)
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} ${${varname}} )
|
||||
ENDIF(${varname}_DEBUG)
|
||||
ENDFOREACH(varname)
|
||||
ENDMACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||
|
||||
357
ChangeLog
357
ChangeLog
@@ -1,7 +1,364 @@
|
||||
Tue, 22 Aug 2017 09:04:49 +0100
|
||||
Author : Robert Osfield
|
||||
Added catch for controbutors list
|
||||
|
||||
Tue, 22 Aug 2017 11:58:49 +0100
|
||||
Author : Robert Osfield
|
||||
Added name typo fix
|
||||
|
||||
Tue, 22 Aug 2017 09:22:41 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #311 from eligovision/masterGeometry::compileGLObjects function VAO fix
|
||||
|
||||
Tue, 22 Aug 2017 09:21:24 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #312 from LaurensVoerman/vnc_pluginReaderWriterVNC.cpp fix g++ warnings
|
||||
|
||||
Mon, 21 Aug 2017 11:15:22 +0200
|
||||
Author : Laurens Voerman
|
||||
ReaderWriterVNC.cpp fix g++ warnings
|
||||
|
||||
Tue, 22 Aug 2017 10:12:36 +0300
|
||||
Author : Konstantin S. Matveyev
|
||||
Geometry::compileGLObjects function VAO fix
|
||||
|
||||
Tue, 22 Aug 2017 08:01:40 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #309 from mp3butcher/osganimationadd DrawElementTypeSimplifierVisitor constructor because default nodevisitor is TRAVERSE_NONE..
|
||||
|
||||
Mon, 21 Aug 2017 18:33:56 +0200
|
||||
Author : Julien Valentin
|
||||
fix nodevisitor construction
|
||||
|
||||
Mon, 21 Aug 2017 16:24:34 +0100
|
||||
Author : Robert Osfield
|
||||
Revert commit 904619e219b5c045b1c8d9d923f52f80089ee24e as it was causeing build problems
|
||||
|
||||
Mon, 21 Aug 2017 15:06:31 +0100
|
||||
Author : Robert Osfield
|
||||
Added handling of CPACK and automatically generated package files
|
||||
|
||||
Mon, 21 Aug 2017 11:40:45 +0100
|
||||
Author : Robert Osfield
|
||||
Using a PR from Sando Mani for requestioning a specific GL version as a base, cleaned up formattating, made the new code paths simpler and added clean up of memory
|
||||
|
||||
Sun, 20 Aug 2017 19:53:41 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #307 from eligovision/master[*] createTexturedQuadGeometry: fixed for GL3 spec
|
||||
|
||||
Sun, 20 Aug 2017 19:52:31 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #308 from OpenMW/collada_valuetype_patchUse osg::Quat::value_type instead of double in collada plugin
|
||||
|
||||
Sun, 20 Aug 2017 15:56:40 +0000
|
||||
Author : scrawl
|
||||
Use osg::Quat::value_type instead of double in collada pluginNote that although the value_type is currently always double, using the proper typedef will open the door to implementing a float Quaternion in the future (as I have done so in my own fork)
|
||||
|
||||
|
||||
Sun, 20 Aug 2017 18:01:49 +0300
|
||||
Author : konstantin.matveyev
|
||||
[*] createTexturedQuadGeometry: fixed for GL3 spec: GL_QUADS -> GL_TRIANGLES
|
||||
|
||||
Sun, 20 Aug 2017 08:32:02 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #306 from AnyOldName3/targa-type-one-supportAdd support for type-1 (colour-mapped, uncompressed) targa images to …
|
||||
|
||||
Sat, 19 Aug 2017 22:22:20 +0100
|
||||
Author : AnyOldName3
|
||||
Add support for type-1 (colour-mapped, uncompressed) targa images to the osgTGA plugin
|
||||
|
||||
Sat, 19 Aug 2017 17:20:40 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #304 from eligovision/masterglClear should not be called with zero-mask in osgUtil::RenderStage::…
|
||||
|
||||
Fri, 18 Aug 2017 16:13:16 +0100
|
||||
Author : Robert Osfield
|
||||
Merged addition of "" around variable from 3.4 branch
|
||||
|
||||
Fri, 18 Aug 2017 10:20:26 +0300
|
||||
Author : Konstantin S. Matveyev
|
||||
glClear should not be called with zero-mask in osgUtil::RenderStage::drawImplementation
|
||||
|
||||
Fri, 18 Aug 2017 08:08:28 +0100
|
||||
Author : Robert Osfield
|
||||
Fixed iterator comparison.
|
||||
|
||||
Thu, 17 Aug 2017 13:55:13 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #301 from LaurensVoerman/Submit_linkWithVariablesfix for visual studio trying to link "debug.lib" and "release.lib"
|
||||
|
||||
Thu, 17 Aug 2017 10:52:59 +0100
|
||||
Author : Robert Osfield
|
||||
Added version check for boolean, TRUE and FALSE settings
|
||||
|
||||
Thu, 17 Aug 2017 11:44:06 +0200
|
||||
Author : Laurens Voerman
|
||||
fix for visual studio trying to link "debug.lib" and "release.lib"
|
||||
|
||||
Wed, 16 Aug 2017 17:51:58 +0100
|
||||
Author : Robert Osfield
|
||||
Added remapping of CMAKE_BUILD_TYPE strings that don't have the correct case.
|
||||
|
||||
Wed, 16 Aug 2017 14:20:00 +0100
|
||||
Author : Robert Osfield
|
||||
Removed the GLclampd declaration and replaced its usage with GLdouble to standardize the OSG extension setup with current GL/GLES headers.Added a float fallback from osg::DepthDangeIndex to suppprt GLES.
|
||||
|
||||
|
||||
Wed, 16 Aug 2017 11:30:14 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #300 from eligovision/masterText3D character/glyph size fix
|
||||
|
||||
Wed, 16 Aug 2017 09:04:02 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #299 from luzpaz/misc-typo-fixesmisc. typo fixes
|
||||
|
||||
Tue, 15 Aug 2017 22:15:31 +0300
|
||||
Author : konstantin.matveyev
|
||||
Merge remote-tracking branch 'upstream/master'
|
||||
|
||||
Tue, 15 Aug 2017 22:11:15 +0300
|
||||
Author : konstantin.matveyev
|
||||
Text3D character/glyph size fixed
|
||||
|
||||
Tue, 15 Aug 2017 12:23:49 -0400
|
||||
Author : luzpaz
|
||||
misc. typo fixesmostly non-user-facing but some doxy.
|
||||
|
||||
Tue, 15 Aug 2017 16:35:23 +0100
|
||||
Author : Robert Osfield
|
||||
Fixed warning
|
||||
|
||||
Tue, 15 Aug 2017 15:42:22 +0100
|
||||
Author : Uwe Woessner
|
||||
Extension to the PLY plugin to read files with textures.
|
||||
|
||||
Tue, 15 Aug 2017 06:39:02 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #298 from eligovision/masterEmscripten: EGL instead of SDL2 in GLExtensions.cpp
|
||||
|
||||
Mon, 14 Aug 2017 14:58:29 +0300
|
||||
Author : konstantin.matveyev
|
||||
Merge remote-tracking branch 'upstream/master'
|
||||
|
||||
Mon, 14 Aug 2017 11:19:04 +0300
|
||||
Author : konstantin.matveyev
|
||||
Emscripten: EGL instead of SDL2 in GLExtensions.cpp
|
||||
|
||||
Tue, 23 May 2017 16:33:16 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced local FindZLIB.cmake usage with CMake's own FindZLIB.cmake, and ZLIB_LIBRARY to ZLIB_LIBRARIES
|
||||
|
||||
Wed, 9 Aug 2017 14:08:59 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #296 from openscenegraph/FullScreenFrom Don Burns, add use of Xinerama to ensure full screen goes across all screens.
|
||||
|
||||
Wed, 9 Aug 2017 08:58:25 +0100
|
||||
Author : Robert Osfield
|
||||
Disabled the building of deprecated serializations in convertity_scan
|
||||
|
||||
Tue, 8 Aug 2017 13:35:35 +0100
|
||||
Author : Anna Sokol
|
||||
In the attached GraphicsWindowWin32.cpp file, I changed order of the "else-if" for the TOUCHEVENTF_UP and TOUCHEVENTF_MOVE, I made it less intrusive then changing them into "if" events. I tested this on Windows 7 64-bit with a touch screen and a Windows 10 64-bit tablet.Separately in the same file, I also needed to address the fact that the close button would not react on touch so I added to the top of the "handleNativeWindowingEvent" close button handling in case of touch events. Again this was tested on the same 2 devices.
|
||||
|
||||
|
||||
Mon, 7 Aug 2017 16:32:44 +0100
|
||||
Author : Robert Osfield
|
||||
Added link to ABI tracker
|
||||
|
||||
Mon, 31 Jul 2017 13:38:18 +0100
|
||||
Author : Robert Osfield
|
||||
Merged #pragmatic shader fix from OpenSceneGraph-3.4 branch.
|
||||
|
||||
Fri, 28 Jul 2017 17:17:25 +0100
|
||||
Author : Robert Osfield
|
||||
Updated version number, ChangeLog and AUTHORS file for 3.5.7 developer release
|
||||
|
||||
Fri, 28 Jul 2017 10:27:47 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #267 from kornerr/masterAdd osgemscripten example
|
||||
|
||||
Wed, 26 Jul 2017 12:54:37 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced FindOurDCMTK.cmake usage with FindDCMTK.cmake
|
||||
|
||||
Wed, 26 Jul 2017 12:26:38 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced local FindOurDCMTK.cmake with stock Cmake's FindDCMTK.cmake as the later is now feature complete and has full support for debug and release libraries.
|
||||
|
||||
Tue, 25 Jul 2017 14:56:27 +0100
|
||||
Author : Robert Osfield
|
||||
Merged MSVC static build fix from OpenSceneGraph-3.4
|
||||
|
||||
Mon, 17 Jul 2017 16:46:16 +0100
|
||||
Author : Anna Sokol
|
||||
Since version 2.5.1 freetype has supported the WOFF extension format. In the attached ReaderWriterFreeType.cpp file I added the following line: supportsExtension("woff","web open font format");
|
||||
|
||||
|
||||
Mon, 17 Jul 2017 07:53:48 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #270 from caishanli/patch-1fix StatsHandler crash on windows
|
||||
|
||||
Mon, 3 Jul 2017 16:24:01 +0800
|
||||
Author : Cai Shanli
|
||||
fix StatsHandler crush on windowschange static_cast to dynamic_cast to avoid type cast error
|
||||
|
||||
Thu, 22 Jun 2017 09:44:06 +0700
|
||||
Author : Michael Kapelko
|
||||
Add osgemscripten example
|
||||
|
||||
Mon, 19 Jun 2017 15:55:42 +0100
|
||||
Author : Robert Osfield
|
||||
Updated SO version number to 149 to enable uint64 object length read/writing in the .osgb format
|
||||
|
||||
Mon, 19 Jun 2017 15:45:35 +0100
|
||||
Author : Robert Osfield
|
||||
Added version checks for when writing out new 64bit object sizes
|
||||
|
||||
Mon, 19 Jun 2017 15:33:52 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced long long with uint64_t
|
||||
|
||||
Mon, 19 Jun 2017 15:25:04 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #264 from rickyviking/binaryStreamLargeBlockBinaryStreamOperator: read and write block size as long long integer
|
||||
|
||||
Mon, 19 Jun 2017 12:04:03 +0100
|
||||
Author : Robert Osfield
|
||||
Added ability for OSG serializers to get the file version number when writing out via the OutputStream object
|
||||
|
||||
Mon, 19 Jun 2017 08:50:00 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #265 from cxw42/array-classnameMake Array::className() support all Array::Type values
|
||||
|
||||
Mon, 19 Jun 2017 08:43:54 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #263 from cxw42/build-fixStill build even if CPACK_GENERATOR is undefined
|
||||
|
||||
Mon, 19 Jun 2017 08:26:24 +0100
|
||||
Author : Robert Osfield
|
||||
Merge branch 'master' of https://github.com/openscenegraph/OpenSceneGraph
|
||||
|
||||
Mon, 19 Jun 2017 08:12:47 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #260 from blobfish/primitiveIndexIntersections and primitive index
|
||||
|
||||
Fri, 16 Jun 2017 09:58:32 -0400
|
||||
Author : Chris White
|
||||
Make Array::className() support all Array::Type'sArray::className() had fallen out of date with respect to Array::Type.
|
||||
This commit updates it, and adds documentation and a debug message to
|
||||
serve as a reminder for future additions of values to Array::Type.
|
||||
|
||||
|
||||
Wed, 14 Jun 2017 16:09:40 +0200
|
||||
Author : Riccardo Corsi
|
||||
BinaryStreamOperator: read and write block size as long long integer on 8 bytes, to accommodate arbitrarily large block size. When reading check of file version for backward compatibility.
|
||||
|
||||
Sat, 10 Jun 2017 22:05:19 -0400
|
||||
Author : cxw
|
||||
Still build even if CPACK_GENERATOR is undefinedWithout the quotes around `${CPACK_GENERATOR}`, Windows CMake, generating
|
||||
for VS2013, would exit with an error because the `STREQUAL` only had one arg.
|
||||
|
||||
|
||||
Thu, 8 Jun 2017 07:10:32 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #261 from cxw42/doxy-osguiAdded osgUI to Doxygen-generated documentation
|
||||
|
||||
Wed, 7 Jun 2017 07:50:55 -0400
|
||||
Author : Chris White
|
||||
Added osgUI to Doxygen-generated documentation
|
||||
|
||||
Fri, 2 Jun 2017 15:43:54 -0400
|
||||
Author : blobfish
|
||||
osg: KdTree: count degenerates to keep original primitive index in sync
|
||||
|
||||
Thu, 1 Jun 2017 15:25:38 -0400
|
||||
Author : blobfish
|
||||
osg: KdTree: encode original primitive index into _vertexIndices
|
||||
|
||||
Tue, 30 May 2017 18:46:03 -0400
|
||||
Author : blobfish
|
||||
osgUtil: LineSegmentIntersector: don't increment primitive index until after adding intersection
|
||||
|
||||
Mon, 29 May 2017 12:19:08 -0400
|
||||
Author : blobfish
|
||||
osgUtil: PolytopeIntersector: don't increment primitive index until after adding intersection
|
||||
|
||||
Tue, 30 May 2017 18:38:25 -0400
|
||||
Author : blobfish
|
||||
examples: osgkeyboardmouse: add primitive index to LineSegmentIntersector output
|
||||
|
||||
Fri, 2 Jun 2017 09:29:05 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #259 from jtorresfabra/fixes_kdtreeFixes kdtree building
|
||||
|
||||
Wed, 31 May 2017 13:30:50 +0200
|
||||
Author : Jordi
|
||||
Fixes kdtree building
|
||||
|
||||
Mon, 29 May 2017 12:20:31 +0100
|
||||
Author : Robert Osfield
|
||||
Added TimeMultiplier and LoopingMode to ImageSequence .osg serializer
|
||||
|
||||
Thu, 25 May 2017 12:38:54 +0100
|
||||
Author : Robert Osfield
|
||||
Improved support for Text with large numbers of glyphs
|
||||
|
||||
Thu, 25 May 2017 09:54:11 +0100
|
||||
Author : Robert Osfield
|
||||
Build fix
|
||||
|
||||
Thu, 25 May 2017 09:37:30 +0100
|
||||
Author : Robert Osfield
|
||||
Merge branch 'master' of https://github.com/openscenegraph/OpenSceneGraph
|
||||
|
||||
Thu, 25 May 2017 09:37:26 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #258 from kornerr/masterAdd x86_64 architecture to iOS simulator
|
||||
|
||||
Thu, 25 May 2017 08:56:53 +0100
|
||||
Author : Robert Osfield
|
||||
Tidied up spacing
|
||||
|
||||
Thu, 25 May 2017 08:48:45 +0100
|
||||
Author : Robert Osfield
|
||||
Fixed naming of OSG_USE_DEPRECATED_API
|
||||
|
||||
Wed, 24 May 2017 19:40:08 +0100
|
||||
Author : Robert Osfield
|
||||
Moved OSG_USE_DEPRECATED_API from include/osg/Export to Cmake controlled include/osg/Config
|
||||
|
||||
Wed, 24 May 2017 19:39:36 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced deprecated API usage
|
||||
|
||||
Wed, 24 May 2017 18:34:22 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced DimensionMask naming with more appropriate PrimitiveMask nameing.
|
||||
|
||||
Wed, 24 May 2017 16:02:29 +0100
|
||||
Author : Robert Osfield
|
||||
Added support for PolytopeIntersector::setDimensionsMask.
|
||||
|
||||
Wed, 24 May 2017 16:01:49 +0100
|
||||
Author : Robert Osfield
|
||||
Aded --dim-mask mask and --dm mask command line option for setting the PolytopeIntersector::setDimensionsMask().
|
||||
|
||||
Wed, 24 May 2017 22:29:19 +0700
|
||||
Author : Michael Kapelko
|
||||
Add x86_64 architecture to iOS simulator
|
||||
|
||||
Fri, 19 May 2017 17:06:36 +0100
|
||||
Author : Robert Osfield
|
||||
Updated ChangeLog for 3.5.6 dev release
|
||||
|
||||
Mon, 15 May 2017 14:53:27 +0100
|
||||
Author : Robert Osfield
|
||||
Refactored COLLADA_BUILDNAME and COLLADA_BOOST_BUILDNAME to resolve case where CMAKE_VS_PLATFORM_TOOLSET is not set.
|
||||
|
||||
Fri, 12 May 2017 16:26:07 +0100
|
||||
Author : Robert Osfield
|
||||
From Don Burns, add use of Xinerama to ensure full screen goes across all screens.
|
||||
|
||||
Thu, 11 May 2017 16:32:13 +0100
|
||||
Author : Robert Osfield
|
||||
Updated AUTHORS file for dev release
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxWindows Library Licence, applying
|
||||
the library as licensed under the wxWindows Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
20
NEWS.txt
20
NEWS.txt
@@ -53,7 +53,7 @@ The !OpenSceneGraph 3.2 release is the culmination of 14 years of work by the op
|
||||
* New OpenGL extensions support including compute shaders, tessellation shaders, integer array formats and associated Vec* classes, primitive restart
|
||||
* Improvements to osgManipulator NodeKit that introduce new manipulators and improve flexibility and customizability
|
||||
* Updates to osgQt to support Qt5 and provide better support for Qt4
|
||||
* New osgGA::Device base class for recieving from and sending events to both real and virtual devices in a generic, extensible way
|
||||
* New osgGA::Device base class for receiving from and sending events to both real and virtual devices in a generic, extensible way
|
||||
* New ZeroConf, RestHTTP and OSC plugins to enable remote control of applications such as controlling desktop systems from tablets and phones
|
||||
* Improvements to osgVolume NodeKit and DICOM plugin for better medical visualization
|
||||
* New TrackVis .trk track files plugin for the visualization of brain scans.
|
||||
@@ -635,7 +635,7 @@ osgpbuffer also example now uses Producer's pbuffer support making it portable a
|
||||
|
||||
API refinements, bug fixes and performance improvements:
|
||||
|
||||
There have been many bug fixes, a number of performance improvements and API cleanups that have occured throughout the 0.9.8 - 0.9.9, too many separate items to enumerate here. Together with the above new features they all go to making the OpenSceneGraph-0.9.9 the most robust, high performance and feature rich version so far, and sets the stage for the upcoming 1.0.
|
||||
There have been many bug fixes, a number of performance improvements and API cleanups that have occurred throughout the 0.9.8 - 0.9.9, too many separate items to enumerate here. Together with the above new features they all go to making the OpenSceneGraph-0.9.9 the most robust, high performance and feature rich version so far, and sets the stage for the upcoming 1.0.
|
||||
|
||||
We would like to thank the following engineers for their contributions in the 0.9.8 - 0.9.9.9 time frame (in alphabetic order):
|
||||
Alberto Farre, Bob Kuehne, Brede Johansen, Carlo Camporesi, Chris Hanson, Don Burns, Donn Mielcarek, Don Tidrow, Farshid Lashkari, Frederic Marmond, Garrett Potts, Igor Kravtchenko, James French, Jan Ciger, John Grant, Joakim Simonsson, Joran Jessurun, Jason Daly, Kevin Moiule, Leandro Motta Barros, Marco Jez, Mason Menninger, Mike Weiblen, Nathan Monteleone, Norman Vine, Olaf Flebbe, Paul Melis, Per Fahlberg, Rainer Oder, Randall Hopper, Reinhard Sainitzer, Robert Osfield, Ruben, Sebastien Grignard, Stephan Huber, Terry Welsh, Thom DeCarlo, Tony Horrobin, Tree, Tugkan Calapoglu, Vivek Rajan, Waltice and Yuzhong Shen
|
||||
@@ -654,7 +654,7 @@ OpenProducer - http://www.andesengineering.com/Producer/index.html
|
||||
OpenThreads - http://openthreads.sf.net
|
||||
xine-lib - http://xinehq.de/
|
||||
|
||||
OpenSceneGraph Commericial Support, Training and Consultancy links:
|
||||
OpenSceneGraph Commercial Support, Training and Consultancy links:
|
||||
|
||||
OpenSceneGraph Professional Services - http://www.openscenegraph.com
|
||||
Andes Engineering - http://www.andesengineering.com
|
||||
@@ -668,7 +668,7 @@ Andes Engineering - http://www.andesengineering.com
|
||||
|
||||
>>> Support for database archives, improved pager, 3d compressed textures
|
||||
|
||||
Release 0.9.8 reflects a continuation of the prior committment to release
|
||||
Release 0.9.8 reflects a continuation of the prior commitment to release
|
||||
often, arriving only two short months after 0.9.7. This contrasts sharply
|
||||
to the long period between 0.9.6-2 and 0.9.7. The following set of
|
||||
improvements and features are part of the 0.9.8 release.
|
||||
@@ -1083,7 +1083,7 @@ Andes Engineering - http://www.andesengineering.com
|
||||
has now been moved to a freetype plug-in which is dynamically loaded on demand,
|
||||
with the core osgText library providing a default font when the plug-in is
|
||||
unavailable. Moving the freetype dependency out of the osgText library makes
|
||||
it just dependant on OpenGL and Standard C++ like the rest of the core libraries,
|
||||
it just dependent on OpenGL and Standard C++ like the rest of the core libraries,
|
||||
allowing osgText to compile by default on all platforms.
|
||||
|
||||
Improved thread safety has also been achieved in the core osg and osgUtil libraries
|
||||
@@ -1508,9 +1508,9 @@ Andes Engineering - http://www.andesengineering.com
|
||||
|
||||
Scene graph optimization has been added which can boost performance
|
||||
on some database by as much as an order of magnititude, this is
|
||||
particularily noticable in .flt based databases. Display list performance
|
||||
particularly noticeable in .flt based databases. Display list performance
|
||||
has also been boosted on NVidia based machines thanks to changing the
|
||||
compilation and execution of display list into two seperate operations.
|
||||
compilation and execution of display list into two separate operations.
|
||||
|
||||
App callbacks are now supported on all Nodes, and there now a proper
|
||||
app traversal which can be used to animate the scene.
|
||||
@@ -1560,7 +1560,7 @@ Andes Engineering - http://www.andesengineering.com
|
||||
the core scene graph library making extremely easy to take advantage of
|
||||
this advanced rendering techinque - normally only seen in research papers.
|
||||
Check out osgimpostor demo to see how easy it is to add osg::Impostor
|
||||
nodes to your own models. Impostors are particularily effective are
|
||||
nodes to your own models. Impostors are particularly effective are
|
||||
reducing scene complexity whilest minimizing the visual impact, making it
|
||||
ideal for scenes with large numbers of complex objects such as a city
|
||||
scene, or a dense forest.
|
||||
@@ -1571,7 +1571,7 @@ Andes Engineering - http://www.andesengineering.com
|
||||
|
||||
The cool thing about both the osgreflect and osgimpostor demos is that
|
||||
there is no hardwiring to achieve the results, the scene graph stores
|
||||
all the information neccessary to specify the number and type of rendering
|
||||
all the information necessary to specify the number and type of rendering
|
||||
passes, and the framework handles the rest behind the scenes. This also
|
||||
makes it very easy to add these advanced rendering techinques to your
|
||||
own applications as everything is cleanly encapsulated with
|
||||
@@ -1583,7 +1583,7 @@ Andes Engineering - http://www.andesengineering.com
|
||||
web or your own.
|
||||
|
||||
osg::Camera has been totally revamped and now supports asymetric
|
||||
and othographics projections in addition to the symetrical perspective
|
||||
and othographics projections in addition to the symmetrical perspective
|
||||
projections.
|
||||
|
||||
And finally, support for texture subloading has been added to osg::Texture
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[](https://travis-ci.org/openscenegraph/OpenSceneGraph)
|
||||
[](https://scan.coverity.com/projects/openscenegraph-openscenegraph)
|
||||
[](https://codedocs.xyz/openscenegraph/OpenSceneGraph/)
|
||||
[ABI Tracker](https://abi-laboratory.pro/tracker/timeline/openscenegraph/ "ABI Tracker")
|
||||
|
||||
# Introduction
|
||||
|
||||
|
||||
@@ -274,7 +274,8 @@ const char* invalidNames[] =
|
||||
"Sun",
|
||||
"I",
|
||||
"TriangleFunctor",
|
||||
"PrimitiveFunctor"
|
||||
"PrimitiveFunctor",
|
||||
"OpenMW"
|
||||
};
|
||||
|
||||
|
||||
@@ -498,7 +499,8 @@ TypoCorrection typoCorrections[] =
|
||||
{"Viganò", "Vigan<EFBFBD>"},
|
||||
{"Vigano", "Vigan<EFBFBD>"},
|
||||
{"Frashud", "Farshid"},
|
||||
{"Dannahauer","Dannahauer"}
|
||||
{"Dannahauer","Dannahauer"},
|
||||
{"Sando","Sandro"}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class Receiver
|
||||
// Define what port to listen and bind to
|
||||
void setPort( const short port );
|
||||
|
||||
// Sync does a blocking wait to recieve next message
|
||||
// Sync does a blocking wait to receive next message
|
||||
void sync( void );
|
||||
|
||||
private :
|
||||
|
||||
@@ -773,7 +773,7 @@ void ComputeNode::initComputingSetup()
|
||||
_dataArray->setBufferObject(_ssbo.get());
|
||||
|
||||
|
||||
_ssbb = new osg::ShaderStorageBufferBinding(0, _ssbo.get(), 0, blockSize);
|
||||
_ssbb = new osg::ShaderStorageBufferBinding(0, _dataArray, 0, blockSize);
|
||||
statesetComputation->setAttributeAndModes(_ssbb.get(), osg::StateAttribute::ON);
|
||||
|
||||
|
||||
|
||||
@@ -108,10 +108,10 @@ class ResetAtomicCounter : public osg::StateAttributeCallback
|
||||
osg::AtomicCounterBufferBinding * acbb = dynamic_cast<osg::AtomicCounterBufferBinding *>(sa);
|
||||
if (acbb)
|
||||
{
|
||||
osg::AtomicCounterBufferObject * acbo = dynamic_cast<osg::AtomicCounterBufferObject*>(acbb->getBufferObject());
|
||||
if (acbo && acbo->getBufferData(0))
|
||||
osg::BufferData * acbd = acbb->getBufferData();
|
||||
if (acbd)
|
||||
{
|
||||
acbo->getBufferData(0)->dirty();
|
||||
acbd->dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,10 +207,10 @@ int main(int argc, char** argv)
|
||||
acboBlue->setUsage(GL_STREAM_COPY);
|
||||
atomicCounterArrayBlue->setBufferObject(acboBlue.get());
|
||||
|
||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbRedAndGreen = new osg::AtomicCounterBufferBinding(0, acboRedAndGreen.get(), 0, sizeof(GLuint)*3);
|
||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbRedAndGreen = new osg::AtomicCounterBufferBinding(0, atomicCounterArrayRedAndGreen.get(), 0, sizeof(GLuint)*3);
|
||||
ss->setAttributeAndModes(acbbRedAndGreen.get());
|
||||
|
||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbBlue = new osg::AtomicCounterBufferBinding(2, acboBlue.get(), 0, sizeof(GLuint));
|
||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbBlue = new osg::AtomicCounterBufferBinding(2, atomicCounterArrayBlue.get(), 0, sizeof(GLuint));
|
||||
ss->setAttributeAndModes(acbbBlue.get());
|
||||
|
||||
acbbRedAndGreen->setUpdateCallback(new ResetAtomicCounter);
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
/// with a different texture. Generally speaking in broad terms
|
||||
/// driver overhead tends to be a huge bottle neck on modern
|
||||
/// hardware (as of late 2016). By using bindless textures
|
||||
/// we can remove alot of calls to the driver to switch active
|
||||
/// we can remove a lot of calls to the driver to switch active
|
||||
/// textures while rendering. What this also allows us to do
|
||||
/// is to consolidate more objects + draw states as we do
|
||||
/// not need to change textures, this save us alot of calls to
|
||||
/// not need to change textures, this save us a lot of calls to
|
||||
/// the driver.
|
||||
///
|
||||
/// This example combines instancing with bindless textures
|
||||
@@ -43,7 +43,7 @@
|
||||
/// a pretty simplified example, where each instance ID is
|
||||
/// used as a index into the array of textures.
|
||||
///
|
||||
/// One of the powerfull things about bindless textures is it allows
|
||||
/// One of the powerful things about bindless textures is it allows
|
||||
/// many more objects to be combined into a single drawable.
|
||||
/// However to do this you may need to add an attribute to
|
||||
/// use an index into the array of texture handles, and not
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
val->_handles = new osg::UInt64Array();
|
||||
val->_handles->resize(count*2,0);
|
||||
val->_handles->setBufferObject(val->_sbbo.get());
|
||||
val->_ssbb = new osg::UniformBufferBinding(0, val->_sbbo.get(), 0, sizeof(GLuint64)*count);
|
||||
val->_ssbb = new osg::UniformBufferBinding(0, val->_handles.get(), 0, sizeof(GLuint64)*count);
|
||||
return val;
|
||||
}
|
||||
BindlessBuffer& operator = (const BindlessBuffer& rhs){
|
||||
@@ -261,7 +261,7 @@ void BindlessTexture::setBidlessIndex(unsigned int index){
|
||||
_bindlessIndex = index;
|
||||
}
|
||||
/// Just as the name suggest this should be called once per
|
||||
/// context, durring its lifetime. This basically
|
||||
/// context, during its lifetime. This basically
|
||||
/// just sets up our texture handles, and loads them
|
||||
/// into our UBO. A good portion of this was copied from
|
||||
/// Texture2D::apply, this is in no ways a general solution.
|
||||
@@ -326,7 +326,7 @@ void BindlessTexture::apply(osg::State& state) const
|
||||
applyOnce(state);
|
||||
_isBound[contextID] = true;
|
||||
}else{
|
||||
//we should mostly hit this durring the lifetime of this object,
|
||||
//we should mostly hit this during the lifetime of this object,
|
||||
//note we basically do nothing......
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class Receiver
|
||||
// Define what port to listen and bind to
|
||||
void setPort( const short port );
|
||||
|
||||
// Sync does a blocking wait to recieve next message
|
||||
// Sync does a blocking wait to receive next message
|
||||
unsigned int sync( void );
|
||||
|
||||
private :
|
||||
|
||||
60
examples/osgemscripten/CMakeLists.txt
Normal file
60
examples/osgemscripten/CMakeLists.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
|
||||
|
||||
# Path to OpenSceneGraph
|
||||
SET(OSG_DIR "${CMAKE_SOURCE_DIR}/../..")
|
||||
|
||||
# Specify critical OpenSceneGraph build variables.
|
||||
SET(BUILD_OSG_APPLICATIONS NO CACHE BOOL "Do not build applications")
|
||||
SET(EGL_LIBRARY "GL" CACHE STRING "Suppress linkage error")
|
||||
SET(OSG_GL1_AVAILABLE OFF CACHE BOOL "Unavailable under Emscripten")
|
||||
SET(OSG_GL2_AVAILABLE OFF CACHE BOOL "Unavailable under Emscripten")
|
||||
SET(OSG_GLES2_AVAILABLE ON CACHE BOOL "GLES2 is what Emscripten uses")
|
||||
SET(DYNAMIC_OPENTHREADS OFF CACHE BOOL "Link OpenThreads statically")
|
||||
SET(DYNAMIC_OPENSCENEGRAPH OFF CACHE BOOL "Link OpenSceneGraph statically")
|
||||
# Reference SDL2 during build process.
|
||||
# We use SDL2 to do the following:
|
||||
# * OpenGL functions' address retrieval
|
||||
# * OpenGL graphics context creation
|
||||
SET(USE_SDL2 "-s USE_SDL=2")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${USE_SDL2}" CACHE STRING "Use SDL2" FORCE)
|
||||
|
||||
# Reference OpenSceneGraph includes and libraries.
|
||||
SET(OSG_SOURCE_DIR "${OSG_DIR}")
|
||||
SET(OSG_BUILD_DIR "${OSG_DIR}/build/Emscripten")
|
||||
INCLUDE_DIRECTORIES(${OSG_SOURCE_DIR}/include)
|
||||
INCLUDE_DIRECTORIES(${OSG_BUILD_DIR}/include)
|
||||
LINK_DIRECTORIES(${OSG_BUILD_DIR}/lib)
|
||||
|
||||
# Build OpenSceneGraph if osgViewer library is missing.
|
||||
IF(EXISTS "${OSG_BUILD_DIR}/lib/libosgViewer.a")
|
||||
MESSAGE("Skip building OpenSceneGraph")
|
||||
ELSE()
|
||||
MESSAGE("Build OpenSceneGraph")
|
||||
FILE(MAKE_DIRECTORY ${OSG_BUILD_DIR})
|
||||
ADD_SUBDIRECTORY(${OSG_SOURCE_DIR} ${OSG_BUILD_DIR})
|
||||
ENDIF()
|
||||
|
||||
# Build example.
|
||||
ADD_EXECUTABLE(osgemscripten osgemscripten.cpp)
|
||||
# Make Emscripten generate ready-to-open HTML page.
|
||||
SET(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
# Make Emscripten preload the resource.
|
||||
SET_TARGET_PROPERTIES(osgemscripten PROPERTIES LINK_FLAGS "--preload-file box.osgt")
|
||||
# Copy the resource to the build directory.
|
||||
CONFIGURE_FILE(box.osgt box.osgt COPYONLY)
|
||||
# Libraries must be linked in the specified order.
|
||||
# Otherwise you may get unsatisified linker errors.
|
||||
TARGET_LINK_LIBRARIES(
|
||||
osgemscripten
|
||||
osgViewer
|
||||
osgDB
|
||||
# osgDB plugins start.
|
||||
osgdb_osg
|
||||
osgdb_serializers_osg
|
||||
# osgDB plugins end.
|
||||
osgGA
|
||||
osgText
|
||||
osgUtil
|
||||
osg
|
||||
OpenThreads
|
||||
)
|
||||
43
examples/osgemscripten/README.md
Normal file
43
examples/osgemscripten/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
How to build osgemscripten example
|
||||
==================================
|
||||
|
||||
### 1. Install Emscripten
|
||||
|
||||
Download and install [Emscripten portable SDK](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)
|
||||
|
||||
### 2. Create build directory
|
||||
|
||||
Run the following commands:
|
||||
|
||||
`mkdir /path/to/build/dir`
|
||||
|
||||
`cd /path/to/build/dir`
|
||||
|
||||
### 3. Configure example
|
||||
|
||||
Run the following command:
|
||||
|
||||
`cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/emsdk-portable/emscripten/<version>/cmake/Modules/Platform/Emscripten.cmake /path/to/OpenSceneGraph/examples/osgemscripten`
|
||||
|
||||
This also configures OpenSceneGraph as a dependency
|
||||
|
||||
### 3. Build example
|
||||
|
||||
Run the following command:
|
||||
|
||||
`make`
|
||||
|
||||
This also builds OpenSceneGraph under `/path/to/OpenSceneGraph/build/Emscripten`
|
||||
if it has not yet been built.
|
||||
|
||||
### 4. Launch example
|
||||
|
||||
Firefox only: locate and open `osgemscripten.html` file.
|
||||
|
||||
All browsers:
|
||||
* go to the directory with `osgemscripten.html`
|
||||
* run `python -m SimpleHTTPServer 8080` from there
|
||||
* open `http://localhost:8080/osgemscripten.html` in any browser
|
||||
|
||||
You should now see red cube in your web browser.
|
||||
|
||||
857
examples/osgemscripten/box.osgt
Normal file
857
examples/osgemscripten/box.osgt
Normal file
@@ -0,0 +1,857 @@
|
||||
#Ascii Scene
|
||||
#Version 92
|
||||
#Generator osgexport 0.13.0
|
||||
|
||||
osg::Group {
|
||||
UniqueID 4
|
||||
Name "Root"
|
||||
Children 1 {
|
||||
osg::MatrixTransform {
|
||||
UniqueID 0
|
||||
Name "Cube"
|
||||
Children 1 {
|
||||
osg::Geode {
|
||||
UniqueID 3
|
||||
Name "GeodeCube.001"
|
||||
Drawables 1 {
|
||||
osg::Geometry {
|
||||
UniqueID 2
|
||||
Name "Cube"
|
||||
PrimitiveSetList 1 {
|
||||
DrawElementsUInt GL_TRIANGLES 576 {
|
||||
0 1 2
|
||||
3 4 5
|
||||
6 7 8
|
||||
9 10 11
|
||||
12 13 14
|
||||
15 16 17
|
||||
18 19 20
|
||||
21 22 23
|
||||
24 25 26
|
||||
27 28 29
|
||||
30 31 32
|
||||
33 34 35
|
||||
36 37 38
|
||||
39 40 41
|
||||
42 43 44
|
||||
45 46 47
|
||||
48 49 50
|
||||
51 52 53
|
||||
54 55 56
|
||||
57 58 59
|
||||
60 61 62
|
||||
63 64 65
|
||||
66 67 68
|
||||
69 70 71
|
||||
72 71 67
|
||||
73 72 66
|
||||
74 69 72
|
||||
75 76 68
|
||||
77 76 75
|
||||
78 66 76
|
||||
79 65 80
|
||||
68 79 81
|
||||
67 63 79
|
||||
82 83 58
|
||||
84 82 57
|
||||
85 86 87
|
||||
88 59 89
|
||||
90 88 91
|
||||
92 57 88
|
||||
93 56 94
|
||||
95 96 97
|
||||
98 99 96
|
||||
100 53 49
|
||||
101 102 103
|
||||
101 104 105
|
||||
106 107 108
|
||||
109 110 111
|
||||
112 103 113
|
||||
114 115 47
|
||||
116 117 118
|
||||
119 120 117
|
||||
121 44 40
|
||||
122 123 124
|
||||
125 126 123
|
||||
127 41 128
|
||||
129 130 131
|
||||
132 124 130
|
||||
133 38 134
|
||||
135 136 133
|
||||
137 36 133
|
||||
138 35 31
|
||||
139 138 30
|
||||
140 33 138
|
||||
141 32 142
|
||||
143 141 144
|
||||
145 30 141
|
||||
146 29 147
|
||||
32 146 148
|
||||
31 27 146
|
||||
149 26 22
|
||||
150 149 21
|
||||
151 24 149
|
||||
152 23 153
|
||||
154 152 155
|
||||
156 21 152
|
||||
157 20 158
|
||||
23 157 159
|
||||
22 18 157
|
||||
160 17 19
|
||||
26 160 18
|
||||
25 15 160
|
||||
12 161 28
|
||||
35 12 27
|
||||
34 13 12
|
||||
162 11 37
|
||||
163 162 36
|
||||
164 9 162
|
||||
165 8 46
|
||||
166 167 120
|
||||
168 169 167
|
||||
170 171 55
|
||||
172 173 99
|
||||
174 175 173
|
||||
176 2 64
|
||||
71 176 63
|
||||
71 70 0
|
||||
176 0 2
|
||||
177 178 179
|
||||
165 6 8
|
||||
162 9 11
|
||||
161 12 14
|
||||
160 15 17
|
||||
157 18 20
|
||||
152 21 23
|
||||
149 24 26
|
||||
146 27 29
|
||||
141 30 32
|
||||
138 33 35
|
||||
133 36 38
|
||||
127 39 41
|
||||
121 42 44
|
||||
115 45 47
|
||||
180 48 50
|
||||
100 51 53
|
||||
93 54 56
|
||||
88 57 59
|
||||
83 82 181
|
||||
79 63 65
|
||||
76 66 68
|
||||
72 69 71
|
||||
66 72 67
|
||||
78 73 66
|
||||
73 74 72
|
||||
182 75 68
|
||||
183 77 75
|
||||
77 78 76
|
||||
81 79 80
|
||||
182 68 81
|
||||
68 67 79
|
||||
57 82 58
|
||||
92 84 57
|
||||
184 85 87
|
||||
91 88 89
|
||||
185 90 91
|
||||
90 92 88
|
||||
186 93 94
|
||||
187 95 97
|
||||
95 98 96
|
||||
48 100 49
|
||||
112 101 103
|
||||
102 101 105
|
||||
188 189 190
|
||||
191 109 111
|
||||
192 112 113
|
||||
193 194 195
|
||||
196 116 118
|
||||
116 119 117
|
||||
39 121 40
|
||||
132 122 124
|
||||
122 125 123
|
||||
197 127 128
|
||||
198 129 131
|
||||
129 132 130
|
||||
199 133 134
|
||||
199 135 133
|
||||
136 137 133
|
||||
30 138 31
|
||||
145 139 30
|
||||
139 140 138
|
||||
144 141 142
|
||||
200 143 144
|
||||
143 145 141
|
||||
148 146 147
|
||||
142 32 148
|
||||
32 31 146
|
||||
21 149 22
|
||||
156 150 21
|
||||
150 151 149
|
||||
155 152 153
|
||||
201 154 155
|
||||
154 156 152
|
||||
159 157 158
|
||||
153 23 159
|
||||
23 22 157
|
||||
18 160 19
|
||||
22 26 18
|
||||
26 25 160
|
||||
27 12 28
|
||||
31 35 27
|
||||
35 34 12
|
||||
36 162 37
|
||||
137 163 36
|
||||
163 164 162
|
||||
45 165 46
|
||||
119 166 120
|
||||
166 168 167
|
||||
54 170 55
|
||||
98 172 99
|
||||
172 174 173
|
||||
63 176 64
|
||||
67 71 63
|
||||
176 71 0
|
||||
}
|
||||
}
|
||||
VertexData {
|
||||
Array TRUE ArrayID 0 Vec3fArray 202 {
|
||||
-1.00000 0.71786 -0.50000
|
||||
-1.00000 1.00000 -1.00000
|
||||
-1.00000 0.50000 -1.00000
|
||||
0.50000 0.71786 -0.50000
|
||||
1.00000 0.71786 -0.50000
|
||||
0.80513 0.86344 -1.00000
|
||||
1.00000 -1.00000 -0.50000
|
||||
1.00000 -1.00000 -1.00000
|
||||
1.00000 -0.50000 -1.00000
|
||||
-1.00000 -1.00000 -0.50000
|
||||
-1.00000 -1.00000 -1.00000
|
||||
-0.50000 -1.00000 -1.00000
|
||||
0.50000 0.50000 -1.00000
|
||||
0.50000 1.00000 -1.00000
|
||||
0.80513 0.86344 -1.00000
|
||||
-0.50000 1.00000 1.00000
|
||||
-1.00000 1.00000 1.00000
|
||||
-1.00000 0.50000 1.00000
|
||||
-0.50000 0.00000 1.00000
|
||||
-1.00000 0.00000 1.00000
|
||||
-1.00000 -0.50000 1.00000
|
||||
0.50000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 -0.50000 1.00000
|
||||
0.50000 1.00000 1.00000
|
||||
0.00000 1.00000 1.00000
|
||||
0.00000 0.50000 1.00000
|
||||
0.50000 0.00000 -1.00000
|
||||
1.00000 0.00000 -1.00000
|
||||
1.00000 -0.50000 -1.00000
|
||||
-0.50000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 -0.50000 -1.00000
|
||||
-0.50000 1.00000 -1.00000
|
||||
0.00000 1.00000 -1.00000
|
||||
0.00000 0.50000 -1.00000
|
||||
0.00000 -1.00000 -0.50000
|
||||
0.00000 -1.00000 -1.00000
|
||||
0.50000 -1.00000 -1.00000
|
||||
0.00000 -0.69802 0.50000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.50000 -1.00000 0.00000
|
||||
-1.00000 -0.69802 0.50000
|
||||
-1.00000 -1.00000 0.00000
|
||||
-0.50000 -1.00000 0.00000
|
||||
1.00000 0.00000 -0.50000
|
||||
1.00000 0.00000 -1.00000
|
||||
1.00000 0.50000 -1.00000
|
||||
1.00000 0.00000 0.50000
|
||||
0.74690 0.00000 0.00000
|
||||
0.74690 0.50000 0.00000
|
||||
1.00000 -0.69802 0.50000
|
||||
0.74690 -1.00000 0.00000
|
||||
0.74690 -0.50000 0.00000
|
||||
0.00000 0.71786 -0.50000
|
||||
0.00000 1.00000 -1.00000
|
||||
-0.50000 1.00000 -1.00000
|
||||
0.00000 1.00000 0.50000
|
||||
0.00000 1.00000 0.00000
|
||||
-0.50000 1.00000 0.00000
|
||||
0.50000 1.00000 0.50000
|
||||
0.80513 0.86344 0.50000
|
||||
0.74690 1.00000 0.00000
|
||||
-1.00000 0.00000 -0.50000
|
||||
-1.00000 0.00000 -1.00000
|
||||
-1.00000 -0.50000 -1.00000
|
||||
-1.00000 0.00000 0.50000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 -0.50000 0.00000
|
||||
-1.00000 1.00000 0.50000
|
||||
-1.00000 1.00000 0.00000
|
||||
-1.00000 0.50000 0.00000
|
||||
-1.00000 0.50000 0.50000
|
||||
-1.00000 0.50000 1.00000
|
||||
-1.00000 1.00000 1.00000
|
||||
-1.00000 -0.69802 0.50000
|
||||
-1.00000 -0.50000 0.50000
|
||||
-1.00000 -0.50000 1.00000
|
||||
-1.00000 0.00000 1.00000
|
||||
-1.00000 -0.50000 -0.50000
|
||||
-1.00000 -1.00000 -1.00000
|
||||
-1.00000 -1.00000 -0.50000
|
||||
0.50000 1.00000 0.50000
|
||||
0.50000 1.00000 0.00000
|
||||
0.50000 1.00000 1.00000
|
||||
0.80513 0.86344 1.00000
|
||||
0.80513 0.86344 0.50000
|
||||
0.50000 1.00000 0.50000
|
||||
-0.50000 1.00000 0.50000
|
||||
-1.00000 1.00000 0.00000
|
||||
-0.50000 1.00000 1.00000
|
||||
-1.00000 1.00000 0.50000
|
||||
0.00000 1.00000 1.00000
|
||||
-0.50000 0.71786 -0.50000
|
||||
-1.00000 1.00000 -1.00000
|
||||
-0.50000 1.00000 0.00000
|
||||
-0.50000 0.71786 -0.50000
|
||||
-1.00000 0.71786 -0.50000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 0.71786 -0.50000
|
||||
1.00000 -0.50000 0.50000
|
||||
1.00000 -0.50000 1.00000
|
||||
1.00000 -0.50000 0.50000
|
||||
1.00000 0.00000 0.50000
|
||||
1.00000 -1.00000 1.00000
|
||||
1.00000 -0.69802 0.50000
|
||||
0.80513 0.86344 0.50000
|
||||
1.00000 0.50000 0.50000
|
||||
0.74690 0.50000 0.00000
|
||||
1.00000 0.50000 1.00000
|
||||
1.00000 0.50000 0.50000
|
||||
0.80513 0.86344 0.50000
|
||||
1.00000 0.00000 1.00000
|
||||
1.00000 0.50000 0.50000
|
||||
1.00000 0.71786 -0.50000
|
||||
1.00000 0.50000 -0.50000
|
||||
0.74690 0.50000 0.00000
|
||||
1.00000 0.50000 -0.50000
|
||||
1.00000 0.71786 -0.50000
|
||||
0.74690 0.00000 0.00000
|
||||
1.00000 0.00000 -0.50000
|
||||
-0.50000 -0.69802 0.50000
|
||||
-0.50000 -1.00000 1.00000
|
||||
-0.50000 -0.69802 0.50000
|
||||
0.00000 -0.69802 0.50000
|
||||
-1.00000 -1.00000 1.00000
|
||||
-1.00000 -0.69802 0.50000
|
||||
0.50000 -0.69802 0.50000
|
||||
0.74690 -1.00000 0.00000
|
||||
0.50000 -1.00000 1.00000
|
||||
0.50000 -0.69802 0.50000
|
||||
1.00000 -0.69802 0.50000
|
||||
0.00000 -1.00000 1.00000
|
||||
0.50000 -1.00000 -0.50000
|
||||
1.00000 -1.00000 -1.00000
|
||||
0.74690 -1.00000 0.00000
|
||||
0.50000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
-0.50000 0.50000 -1.00000
|
||||
-1.00000 0.50000 -1.00000
|
||||
-1.00000 1.00000 -1.00000
|
||||
-0.50000 -0.50000 -1.00000
|
||||
0.00000 -1.00000 -1.00000
|
||||
-1.00000 -0.50000 -1.00000
|
||||
-0.50000 -1.00000 -1.00000
|
||||
-1.00000 0.00000 -1.00000
|
||||
0.50000 -0.50000 -1.00000
|
||||
1.00000 -1.00000 -1.00000
|
||||
0.50000 -1.00000 -1.00000
|
||||
0.50000 0.50000 1.00000
|
||||
1.00000 0.50000 1.00000
|
||||
0.80513 0.86344 1.00000
|
||||
0.50000 -0.50000 1.00000
|
||||
0.00000 -1.00000 1.00000
|
||||
1.00000 -0.50000 1.00000
|
||||
0.50000 -1.00000 1.00000
|
||||
1.00000 0.00000 1.00000
|
||||
-0.50000 -0.50000 1.00000
|
||||
-1.00000 -1.00000 1.00000
|
||||
-0.50000 -1.00000 1.00000
|
||||
-0.50000 0.50000 1.00000
|
||||
1.00000 0.50000 -1.00000
|
||||
-0.50000 -1.00000 -0.50000
|
||||
-0.50000 -1.00000 0.00000
|
||||
-1.00000 -1.00000 0.00000
|
||||
1.00000 -0.50000 -0.50000
|
||||
0.74690 -0.50000 0.00000
|
||||
1.00000 -0.50000 -0.50000
|
||||
0.74690 -1.00000 0.00000
|
||||
1.00000 -1.00000 -0.50000
|
||||
0.50000 0.71786 -0.50000
|
||||
0.50000 1.00000 -1.00000
|
||||
0.50000 1.00000 0.00000
|
||||
0.50000 0.71786 -0.50000
|
||||
0.74690 1.00000 0.00000
|
||||
1.00000 0.71786 -0.50000
|
||||
-1.00000 0.50000 -0.50000
|
||||
0.50000 1.00000 -1.00000
|
||||
0.50000 0.71786 -0.50000
|
||||
0.80513 0.86344 -1.00000
|
||||
1.00000 0.50000 0.50000
|
||||
0.74690 1.00000 0.00000
|
||||
-1.00000 -1.00000 0.00000
|
||||
-1.00000 -1.00000 1.00000
|
||||
0.50000 1.00000 1.00000
|
||||
-1.00000 1.00000 1.00000
|
||||
-1.00000 0.71786 -0.50000
|
||||
-1.00000 1.00000 0.00000
|
||||
0.74690 1.00000 0.00000
|
||||
0.80513 0.86344 0.50000
|
||||
0.74690 0.50000 0.00000
|
||||
0.80513 0.86344 1.00000
|
||||
1.00000 0.50000 1.00000
|
||||
0.80513 0.86344 -1.00000
|
||||
1.00000 0.71786 -0.50000
|
||||
1.00000 0.50000 -1.00000
|
||||
0.74690 1.00000 0.00000
|
||||
1.00000 -0.69802 0.50000
|
||||
1.00000 -1.00000 1.00000
|
||||
1.00000 -1.00000 -0.50000
|
||||
-1.00000 -1.00000 -1.00000
|
||||
1.00000 -1.00000 1.00000
|
||||
}
|
||||
Indices FALSE
|
||||
Binding BIND_PER_VERTEX
|
||||
Normalize 0
|
||||
}
|
||||
NormalData {
|
||||
Array TRUE ArrayID 1 Vec3fArray 202 {
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
0.00000 0.96013 0.27955
|
||||
0.00000 0.96013 0.27955
|
||||
0.00000 0.96013 0.27955
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
-0.00000 -0.00000 -1.00000
|
||||
-0.00000 -0.00000 -1.00000
|
||||
-0.00000 -0.00000 -1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
0.89220 0.00000 -0.45164
|
||||
0.89220 0.00000 -0.45164
|
||||
0.89220 0.00000 -0.45164
|
||||
0.89220 0.00000 -0.45164
|
||||
0.89220 0.00000 -0.45164
|
||||
0.89220 0.00000 -0.45164
|
||||
-0.00000 0.87091 0.49144
|
||||
-0.00000 0.87091 0.49144
|
||||
-0.00000 0.87091 0.49144
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.40044 0.89473 0.19774
|
||||
0.40044 0.89473 0.19774
|
||||
0.40044 0.89473 0.19774
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.40851 0.91275 -0.00000
|
||||
0.40851 0.91275 -0.00000
|
||||
0.40851 0.91275 -0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
0.00000 1.00000 0.00000
|
||||
-0.00000 0.87091 0.49144
|
||||
-0.00000 0.87091 0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.89220 0.00000 -0.45164
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
0.80484 0.43155 -0.40742
|
||||
0.80484 0.43155 -0.40742
|
||||
0.80484 0.43155 -0.40742
|
||||
0.88130 0.47255 -0.00000
|
||||
0.88130 0.47255 -0.00000
|
||||
0.88130 0.47255 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
1.00000 0.00000 0.00000
|
||||
1.00000 0.00000 0.00000
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.00000 -0.85599 0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
-0.00000 -0.85599 -0.51699
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
-0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 1.00000
|
||||
0.00000 0.00000 -1.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
0.00000 -1.00000 0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
0.89220 0.00000 0.45164
|
||||
-0.00000 0.87091 0.49144
|
||||
-0.00000 0.87091 0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
-1.00000 0.00000 0.00000
|
||||
0.36317 0.81145 0.45789
|
||||
0.36317 0.81145 0.45789
|
||||
0.36317 0.81145 0.45789
|
||||
0.89220 0.00000 -0.45164
|
||||
0.00000 1.00000 0.00000
|
||||
-1.00000 -0.00000 0.00000
|
||||
-1.00000 0.00000 0.00000
|
||||
0.40851 0.91275 0.00000
|
||||
0.00000 1.00000 -0.00000
|
||||
0.00000 0.87091 0.49144
|
||||
0.00000 0.87091 -0.49144
|
||||
0.99329 0.00000 -0.11568
|
||||
0.99329 0.00000 -0.11568
|
||||
0.99329 0.00000 -0.11568
|
||||
0.88130 0.47255 0.00000
|
||||
1.00000 0.00000 -0.00000
|
||||
0.86320 0.46284 -0.20167
|
||||
0.86320 0.46284 -0.20167
|
||||
0.86320 0.46284 -0.20167
|
||||
0.89220 -0.00000 0.45164
|
||||
0.00000 -0.85599 0.51699
|
||||
0.00000 -0.85599 -0.51699
|
||||
0.00000 -1.00000 0.00000
|
||||
-0.00000 -0.00000 -1.00000
|
||||
-0.00000 0.00000 1.00000
|
||||
}
|
||||
Indices FALSE
|
||||
Binding BIND_PER_VERTEX
|
||||
Normalize 0
|
||||
}
|
||||
TexCoordData 1 {
|
||||
Data {
|
||||
Array TRUE ArrayID 2 Vec2fArray 202 {
|
||||
0.24987 0.57156
|
||||
0.33316 0.50121
|
||||
0.33316 0.62589
|
||||
0.58434 0.12457
|
||||
0.58427 0.00000
|
||||
0.66715 0.05008
|
||||
0.08352 0.50121
|
||||
0.00024 0.50121
|
||||
0.00016 0.37667
|
||||
0.74911 0.49874
|
||||
0.66715 0.49874
|
||||
0.66715 0.37405
|
||||
0.75013 0.62595
|
||||
0.66684 0.62595
|
||||
0.68959 0.54986
|
||||
0.66684 0.87532
|
||||
0.66684 1.00000
|
||||
0.58355 1.00000
|
||||
0.50026 0.87532
|
||||
0.50026 1.00000
|
||||
0.41697 1.00000
|
||||
0.50026 0.62595
|
||||
0.50026 0.75063
|
||||
0.41697 0.75063
|
||||
0.66684 0.62595
|
||||
0.66684 0.75063
|
||||
0.58355 0.75063
|
||||
0.83342 0.62595
|
||||
0.83342 0.50126
|
||||
0.91671 0.50126
|
||||
0.83342 0.87532
|
||||
0.83342 0.75063
|
||||
0.91671 0.75063
|
||||
0.66684 0.87532
|
||||
0.66684 0.75063
|
||||
0.75013 0.75063
|
||||
0.74911 0.24937
|
||||
0.66715 0.24937
|
||||
0.66715 0.12468
|
||||
0.92198 0.24937
|
||||
0.83107 0.24937
|
||||
0.83107 0.12468
|
||||
0.92198 0.49874
|
||||
0.83107 0.49874
|
||||
0.83107 0.37405
|
||||
0.08335 0.25213
|
||||
0.00008 0.25213
|
||||
0.00000 0.12759
|
||||
0.24990 0.25213
|
||||
0.16747 0.24908
|
||||
0.16739 0.12454
|
||||
0.25001 0.42599
|
||||
0.16763 0.49816
|
||||
0.16755 0.37362
|
||||
0.58440 0.24915
|
||||
0.66685 0.25211
|
||||
0.66691 0.37669
|
||||
0.41702 0.25211
|
||||
0.50030 0.25211
|
||||
0.50036 0.37669
|
||||
0.41696 0.12754
|
||||
0.41732 0.05008
|
||||
0.50021 0.06602
|
||||
0.24987 0.75058
|
||||
0.33316 0.75058
|
||||
0.33316 0.87526
|
||||
0.08329 0.75058
|
||||
0.16658 0.75058
|
||||
0.16658 0.87526
|
||||
0.08329 0.50121
|
||||
0.16658 0.50121
|
||||
0.16658 0.62589
|
||||
0.08329 0.62589
|
||||
0.00000 0.62589
|
||||
0.00000 0.50121
|
||||
0.08329 0.92464
|
||||
0.08329 0.87526
|
||||
0.00000 0.87526
|
||||
0.00000 0.75058
|
||||
0.24987 0.87526
|
||||
0.33316 0.99995
|
||||
0.24987 0.99995
|
||||
0.41696 0.12754
|
||||
0.50024 0.12754
|
||||
0.33368 0.12754
|
||||
0.33404 0.05008
|
||||
0.41732 0.05008
|
||||
0.41696 0.12754
|
||||
0.41708 0.37669
|
||||
0.50042 0.50126
|
||||
0.33381 0.37669
|
||||
0.41714 0.50126
|
||||
0.33375 0.25211
|
||||
0.58446 0.37372
|
||||
0.66698 0.50126
|
||||
0.50036 0.37669
|
||||
0.58446 0.37372
|
||||
0.58452 0.49830
|
||||
0.50030 0.25211
|
||||
0.58440 0.24915
|
||||
0.24998 0.37667
|
||||
0.33325 0.37667
|
||||
0.24998 0.37667
|
||||
0.24990 0.25213
|
||||
0.33333 0.50121
|
||||
0.25001 0.42599
|
||||
0.25041 0.03472
|
||||
0.24982 0.12759
|
||||
0.16739 0.12454
|
||||
0.33309 0.12759
|
||||
0.24982 0.12759
|
||||
0.25041 0.03472
|
||||
0.33317 0.25213
|
||||
0.24982 0.12759
|
||||
0.08324 0.07332
|
||||
0.08327 0.12759
|
||||
0.16739 0.12454
|
||||
0.08327 0.12759
|
||||
0.08324 0.07332
|
||||
0.16747 0.24908
|
||||
0.08335 0.25213
|
||||
0.92198 0.37405
|
||||
0.99498 0.37405
|
||||
0.92198 0.37405
|
||||
0.92198 0.24937
|
||||
0.99498 0.49874
|
||||
0.92198 0.49874
|
||||
0.92198 0.12468
|
||||
0.83107 0.06312
|
||||
0.99498 0.12468
|
||||
0.92198 0.12468
|
||||
0.92198 0.00000
|
||||
0.99498 0.24937
|
||||
0.74911 0.12468
|
||||
0.66715 0.00000
|
||||
0.83107 0.06312
|
||||
0.83107 0.12468
|
||||
0.83107 0.24937
|
||||
0.75013 0.87532
|
||||
0.75013 1.00000
|
||||
0.66684 1.00000
|
||||
0.91671 0.87532
|
||||
1.00000 0.75063
|
||||
0.91671 1.00000
|
||||
1.00000 0.87532
|
||||
0.83342 1.00000
|
||||
0.91671 0.62595
|
||||
1.00000 0.50126
|
||||
1.00000 0.62595
|
||||
0.58355 0.62595
|
||||
0.58355 0.50126
|
||||
0.64409 0.54986
|
||||
0.41697 0.62595
|
||||
0.33368 0.75063
|
||||
0.41697 0.50126
|
||||
0.33368 0.62595
|
||||
0.50026 0.50126
|
||||
0.41697 0.87532
|
||||
0.33368 1.00000
|
||||
0.33368 0.87532
|
||||
0.58355 0.87532
|
||||
0.75013 0.50126
|
||||
0.74911 0.37405
|
||||
0.83107 0.37405
|
||||
0.83107 0.49874
|
||||
0.08343 0.37667
|
||||
0.16755 0.37362
|
||||
0.08343 0.37667
|
||||
0.16763 0.49816
|
||||
0.08352 0.50121
|
||||
0.58434 0.12457
|
||||
0.66679 0.12754
|
||||
0.50024 0.12754
|
||||
0.58434 0.12457
|
||||
0.50021 0.06602
|
||||
0.58427 0.00000
|
||||
0.24987 0.62589
|
||||
0.66679 0.12754
|
||||
0.58434 0.12457
|
||||
0.66715 0.05008
|
||||
0.24982 0.12759
|
||||
0.50021 0.06602
|
||||
0.16658 0.99995
|
||||
0.00000 0.99995
|
||||
0.33368 0.12754
|
||||
0.33387 0.50126
|
||||
0.58452 0.49830
|
||||
0.50042 0.50126
|
||||
0.16731 0.00000
|
||||
0.25041 0.03472
|
||||
0.16739 0.12454
|
||||
0.33368 0.03472
|
||||
0.33309 0.12759
|
||||
0.00059 0.03472
|
||||
0.08324 0.07332
|
||||
0.00000 0.12759
|
||||
0.16731 0.00000
|
||||
0.92198 0.00000
|
||||
0.99498 0.00000
|
||||
0.74911 0.00000
|
||||
1.00000 1.00000
|
||||
0.33368 0.50126
|
||||
}
|
||||
Indices FALSE
|
||||
Binding BIND_PER_VERTEX
|
||||
Normalize 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Matrix {
|
||||
1.00000 0.00000 0.00000 0.00000
|
||||
0.00000 1.00000 0.00000 0.00000
|
||||
0.00000 0.00000 1.00000 0.00000
|
||||
0.00000 0.00000 0.00000 1.00000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
76
examples/osgemscripten/functions.h
Normal file
76
examples/osgemscripten/functions.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* OpenSceneGraph example, osgemscripten.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSGEMSCRIPTEN_FUNCTIONS_H
|
||||
#define OSGEMSCRIPTEN_FUNCTIONS_H
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
// Convert NotifySeverity enum value to string.
|
||||
std::string logLevelToString(osg::NotifySeverity severity)
|
||||
{
|
||||
switch (severity)
|
||||
{
|
||||
case osg::DEBUG_FP:
|
||||
// Verbose.
|
||||
return "V";
|
||||
case osg::DEBUG_INFO:
|
||||
// Debug.
|
||||
return "D";
|
||||
case osg::NOTICE:
|
||||
case osg::INFO:
|
||||
// Info.
|
||||
return "I";
|
||||
case osg::WARN:
|
||||
// Warning.
|
||||
return "W";
|
||||
case osg::FATAL:
|
||||
case osg::ALWAYS:
|
||||
// Error.
|
||||
return "E";
|
||||
}
|
||||
}
|
||||
|
||||
#include <osg/Program>
|
||||
|
||||
// Fragment shader to display everything in red colour.
|
||||
static const char shaderFragment[] =
|
||||
"void main() { \n"
|
||||
" gl_FragColor = vec4(0.5, 0.3, 0.3, 1.0);\n"
|
||||
"} \n";
|
||||
// Geometry shader to pass geometry vertices to fragment shader.
|
||||
static const char shaderVertex[] =
|
||||
"void main() { \n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
|
||||
"} \n";
|
||||
|
||||
osg::Program *createShaderProgram(
|
||||
const std::string &vertexShader,
|
||||
const std::string &fragmentShader)
|
||||
{
|
||||
// Load shaders.
|
||||
osg::Shader *vs = new osg::Shader(osg::Shader::VERTEX, vertexShader);
|
||||
osg::Shader *fs = new osg::Shader(osg::Shader::FRAGMENT, fragmentShader);
|
||||
// Compile shaders and compose shader program.
|
||||
osg::Program *prog = new osg::Program;
|
||||
prog->addShader(vs);
|
||||
prog->addShader(fs);
|
||||
return prog;
|
||||
}
|
||||
|
||||
#endif // OSGEMSCRIPTEN_FUNCTIONS_H
|
||||
84
examples/osgemscripten/osgemscripten.cpp
Normal file
84
examples/osgemscripten/osgemscripten.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/* OpenSceneGraph example, emscripten.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include "osgemscripten.h"
|
||||
|
||||
// We use app global variable in loop() function.
|
||||
Application *app = 0;
|
||||
|
||||
// Stand alone function that is called by Emscripten to run the app.
|
||||
void loop()
|
||||
{
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e))
|
||||
{
|
||||
if (app)
|
||||
{
|
||||
app->handleEvent(e);
|
||||
}
|
||||
}
|
||||
if (app)
|
||||
{
|
||||
app->frame();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Make sure SDL is working.
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
printf("OSGWeb. Could not init SDL: '%s'\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
// Clean SDL up at exit.
|
||||
atexit(SDL_Quit);
|
||||
// Configure rendering context.
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
// Create rendering window.
|
||||
int width = 800;
|
||||
int height = 600;
|
||||
SDL_Window* window =
|
||||
SDL_CreateWindow(
|
||||
"OSGWeb",
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
width,
|
||||
height,
|
||||
SDL_WINDOW_OPENGL);
|
||||
if (!window)
|
||||
{
|
||||
printf("OSGWeb. Could not create window: '%s'\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
SDL_GL_CreateContext(window);
|
||||
// Create application.
|
||||
app = new Application;
|
||||
app->setupWindow(width, height);
|
||||
app->loadScene("box.osgt");
|
||||
// Render asynchronously.
|
||||
emscripten_set_main_loop(loop, -1, 0);
|
||||
return 0;
|
||||
}
|
||||
180
examples/osgemscripten/osgemscripten.h
Normal file
180
examples/osgemscripten/osgemscripten.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/* OpenSceneGraph example, osgemscripten.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSGEMSCRIPTEN_OSGEMSCRIPTEN_H
|
||||
#define OSGEMSCRIPTEN_OSGEMSCRIPTEN_H
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
|
||||
// VBO setup visitor.
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/NodeVisitor>
|
||||
|
||||
// Initialize OSG plugins statically.
|
||||
USE_OSGPLUGIN(osg2)
|
||||
USE_SERIALIZER_WRAPPER_LIBRARY(osg)
|
||||
|
||||
// This class prints OpenSceneGraph notifications to console.
|
||||
class Logger : public osg::NotifyHandler
|
||||
{
|
||||
public:
|
||||
Logger() { }
|
||||
virtual ~Logger() { }
|
||||
|
||||
// Override NotifyHandler::notify() to receive OpenSceneGraph notifications.
|
||||
void notify(osg::NotifySeverity severity, const char *message)
|
||||
{
|
||||
printf("OSG/%s %s", logLevelToString(severity).c_str(), message);
|
||||
}
|
||||
};
|
||||
|
||||
// This class forces the use of VBO.
|
||||
class VBOSetupVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
VBOSetupVisitor() :
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { }
|
||||
virtual void apply(osg::Geode &geode)
|
||||
{
|
||||
for (unsigned int i = 0; i < geode.getNumDrawables(); ++i)
|
||||
{
|
||||
osg::Geometry *geom =
|
||||
dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||
if (geom)
|
||||
{
|
||||
geom->setUseVertexBufferObjects(true);
|
||||
}
|
||||
}
|
||||
NodeVisitor::apply(geode);
|
||||
}
|
||||
};
|
||||
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
Application()
|
||||
{
|
||||
setupLogging();
|
||||
setupRendering();
|
||||
}
|
||||
~Application()
|
||||
{
|
||||
tearDownLogging();
|
||||
tearDownRendering();
|
||||
}
|
||||
|
||||
bool handleEvent(SDL_Event &e)
|
||||
{
|
||||
osgViewer::GraphicsWindow *gw =
|
||||
dynamic_cast<osgViewer::GraphicsWindow *>(
|
||||
mViewer->getCamera()->getGraphicsContext());
|
||||
if (!gw)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
osgGA::EventQueue &queue = *(gw->getEventQueue());
|
||||
switch (e.type)
|
||||
{
|
||||
case SDL_MOUSEMOTION:
|
||||
queue.mouseMotion(e.motion.x, e.motion.y);
|
||||
return true;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
queue.mouseButtonPress(e.button.x, e.button.y, e.button.button);
|
||||
printf("OSGWeb. Application. Mouse button down\n");
|
||||
return true;
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
queue.mouseButtonRelease(e.button.x, e.button.y, e.button.button);
|
||||
printf("OSGWeb. Application. Mouse button up\n");
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void loadScene(const std::string &fileName)
|
||||
{
|
||||
// Load scene.
|
||||
osg::Node *scene = osgDB::readNodeFile(fileName);
|
||||
if (!scene)
|
||||
{
|
||||
printf("Could not load scene\n");
|
||||
return;
|
||||
}
|
||||
// Use VBO and EBO instead of display lists. CRITICAL for Emscripten
|
||||
// to skip FULL_ES2 emulation flag.
|
||||
VBOSetupVisitor vbo;
|
||||
scene->accept(vbo);
|
||||
// Load shaders.
|
||||
osg::Program *prog = createShaderProgram(shaderVertex, shaderFragment);
|
||||
// Apply shaders.
|
||||
scene->getOrCreateStateSet()->setAttribute(prog);
|
||||
// Set scene.
|
||||
mViewer->setSceneData(scene);
|
||||
}
|
||||
void setupWindow(int width, int height)
|
||||
{
|
||||
mViewer->setUpViewerAsEmbeddedInWindow(0, 0, width, height);
|
||||
}
|
||||
void frame()
|
||||
{
|
||||
mViewer->frame();
|
||||
}
|
||||
|
||||
private:
|
||||
void setupLogging()
|
||||
{
|
||||
// Create custom logger.
|
||||
mLogger = new Logger;
|
||||
// Provide the logger to OpenSceneGraph.
|
||||
osg::setNotifyHandler(mLogger);
|
||||
// Only accept notifications of Info level or higher
|
||||
// like warnings and errors.
|
||||
osg::setNotifyLevel(osg::INFO);
|
||||
}
|
||||
void setupRendering()
|
||||
{
|
||||
// Create OpenSceneGraph viewer.
|
||||
mViewer = new osgViewer::Viewer;
|
||||
// Use single thread: CRITICAL for Emscripten.
|
||||
mViewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
|
||||
// Create manipulator: CRITICAL for Emscripten.
|
||||
mViewer->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||
}
|
||||
void tearDownLogging()
|
||||
{
|
||||
// Remove the logger from OpenSceneGraph.
|
||||
// This also destroys the logger: no need to deallocate it manually.
|
||||
osg::setNotifyHandler(0);
|
||||
}
|
||||
void tearDownRendering()
|
||||
{
|
||||
delete mViewer;
|
||||
}
|
||||
|
||||
private:
|
||||
Logger *mLogger;
|
||||
osgViewer::Viewer *mViewer;
|
||||
};
|
||||
|
||||
#endif // OSGEMSCRIPTEN_OSGEMSCRIPTEN_H
|
||||
@@ -36,17 +36,13 @@
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osg/BufferTemplate>
|
||||
#include <osg/PrimitiveSetIndirect>
|
||||
#include "ShapeToGeometry.h"
|
||||
#include "AggregateGeometryVisitor.h"
|
||||
#if 0
|
||||
#include "DrawIndirectPrimitiveSet.h"
|
||||
#else
|
||||
#include <osg/PrimitiveSetIndirect>
|
||||
#endif
|
||||
#include "GpuCullShaders.h"
|
||||
|
||||
|
||||
|
||||
// each instance type may have max 8 LODs ( if you change
|
||||
// this value, don't forget to change it in vertex shaders accordingly )
|
||||
const unsigned int OSGGPUCULL_MAXIMUM_LOD_NUMBER = 8;
|
||||
@@ -180,17 +176,20 @@ struct IndirectTarget
|
||||
IndirectTarget()
|
||||
: maxTargetQuantity(0)
|
||||
{
|
||||
indirectCommands = new osg::DefaultIndirectCommandDrawArrays;
|
||||
indirectCommands->getBufferObject()->setUsage(GL_DYNAMIC_DRAW);
|
||||
indirectCommands = new osg::DrawArraysIndirectCommandArray ;
|
||||
}
|
||||
IndirectTarget( AggregateGeometryVisitor* agv, osg::Program* program )
|
||||
: geometryAggregator(agv), drawProgram(program), maxTargetQuantity(0)
|
||||
{
|
||||
indirectCommands = new osg::DefaultIndirectCommandDrawArrays;
|
||||
indirectCommands->getBufferObject()->setUsage(GL_DYNAMIC_DRAW);
|
||||
indirectCommands = new osg::DrawArraysIndirectCommandArray;
|
||||
}
|
||||
void endRegister(unsigned int index, unsigned int rowsPerInstance, GLenum pixelFormat, GLenum type, GLint internalFormat, bool useMultiDrawArraysIndirect )
|
||||
{
|
||||
|
||||
osg::DrawIndirectBufferObject * indirectCommandbuffer=new osg::DrawIndirectBufferObject();
|
||||
indirectCommandbuffer->setUsage(GL_DYNAMIC_DRAW);
|
||||
indirectCommands->setBufferObject(indirectCommandbuffer);
|
||||
|
||||
indirectCommandTextureBuffer = new osg::TextureBuffer(indirectCommands);
|
||||
indirectCommandTextureBuffer->setInternalFormat( GL_R32I );
|
||||
indirectCommandTextureBuffer->bindToImageUnit(index, osg::Texture::READ_WRITE);
|
||||
@@ -200,27 +199,28 @@ struct IndirectTarget
|
||||
// add proper primitivesets to geometryAggregators
|
||||
if( !useMultiDrawArraysIndirect ) // use glDrawArraysIndirect()
|
||||
{
|
||||
std::vector<osg::DrawArraysIndirect*> newPrimitiveSets;
|
||||
std::vector<DrawArraysIndirect*> newPrimitiveSets;
|
||||
|
||||
for(unsigned int j=0;j<indirectCommands->size(); ++j){
|
||||
osg::DrawArraysIndirect *ipr=new osg::DrawArraysIndirect( GL_TRIANGLES, j );
|
||||
ipr->setIndirectCommandArray( indirectCommands);
|
||||
newPrimitiveSets.push_back(ipr);
|
||||
}
|
||||
for(unsigned int j=0;j<indirectCommands->size(); ++j)
|
||||
newPrimitiveSets.push_back( new DrawArraysIndirect( GL_TRIANGLES, j*sizeof( osg::DrawArraysIndirectCommand ), indirectCommands ) );
|
||||
|
||||
geometryAggregator->getAggregatedGeometry()->removePrimitiveSet(0,geometryAggregator->getAggregatedGeometry()->getNumPrimitiveSets() );
|
||||
|
||||
for(unsigned int j=0;j<indirectCommands->size(); ++j)
|
||||
geometryAggregator->getAggregatedGeometry()->addPrimitiveSet( newPrimitiveSets[j] );
|
||||
|
||||
|
||||
/*DrawIndirectBufferBinding should be deprecated
|
||||
///attach a DrawIndirect buffer binding to the stateset for non builtin primset DrawArraysIndirect
|
||||
osg::ref_ptr<osg::DrawIndirectBufferBinding> bb=new osg::DrawIndirectBufferBinding();
|
||||
bb->setBufferObject(indirectCommandbuffer );
|
||||
geometryAggregator->getAggregatedGeometry()->getOrCreateStateSet()->setAttribute(bb );*/
|
||||
}
|
||||
else // use glMultiDrawArraysIndirect()
|
||||
{
|
||||
osg::MultiDrawArraysIndirect *ipr=new osg::MultiDrawArraysIndirect( GL_TRIANGLES );
|
||||
ipr->setIndirectCommandArray( indirectCommands );
|
||||
osg::MultiDrawArraysIndirect * mdi=new osg::MultiDrawArraysIndirect(GL_TRIANGLES);
|
||||
mdi->setIndirectCommandArray(indirectCommands);
|
||||
geometryAggregator->getAggregatedGeometry()->removePrimitiveSet(0,geometryAggregator->getAggregatedGeometry()->getNumPrimitiveSets() );
|
||||
geometryAggregator->getAggregatedGeometry()->addPrimitiveSet( ipr );
|
||||
geometryAggregator->getAggregatedGeometry()->addPrimitiveSet(mdi );
|
||||
|
||||
}
|
||||
|
||||
geometryAggregator->getAggregatedGeometry()->setUseDisplayList(false);
|
||||
@@ -266,7 +266,7 @@ struct IndirectTarget
|
||||
stateset->setAttributeAndModes( drawProgram.get(), osg::StateAttribute::ON );
|
||||
}
|
||||
|
||||
osg::ref_ptr< osg::DefaultIndirectCommandDrawArrays > indirectCommands;
|
||||
osg::ref_ptr< osg::DrawArraysIndirectCommandArray > indirectCommands;
|
||||
osg::ref_ptr<osg::TextureBuffer> indirectCommandTextureBuffer;
|
||||
osg::ref_ptr< AggregateGeometryVisitor > geometryAggregator;
|
||||
osg::ref_ptr<osg::Program> drawProgram;
|
||||
@@ -286,7 +286,7 @@ struct GPUCullData
|
||||
instanceTypesUBO = new osg::UniformBufferObject;
|
||||
// instanceTypesUBO->setUsage( GL_STREAM_DRAW );
|
||||
instanceTypes->setBufferObject( instanceTypesUBO.get() );
|
||||
instanceTypesUBB = new osg::UniformBufferBinding(1, instanceTypesUBO.get(), 0, 0);
|
||||
instanceTypesUBB = new osg::UniformBufferBinding(1, instanceTypes.get(), 0, 0);
|
||||
|
||||
}
|
||||
void setUseMultiDrawArraysIndirect( bool value )
|
||||
@@ -316,7 +316,7 @@ struct GPUCullData
|
||||
// AggregateGeometryVisitor creates single osg::Geometry from all objects used by specific indirect target
|
||||
AggregateGeometryVisitor::AddObjectResult aoResult = target->second.geometryAggregator->addObject( node , typeID, lodNumber );
|
||||
// Information about first vertex and a number of vertices is stored for later primitiveset creation
|
||||
target->second.indirectCommands->push_back( osg::DrawArraysIndirectCommand( aoResult.count,1, aoResult.first ) );
|
||||
target->second.indirectCommands->push_back( osg::DrawArraysIndirectCommand( aoResult.count,1,aoResult.first ) );
|
||||
|
||||
osg::ComputeBoundsVisitor cbv;
|
||||
node->accept(cbv);
|
||||
@@ -725,9 +725,9 @@ struct ResetTexturesCallback : public osg::StateSet::Callback
|
||||
osg::TextureBuffer* tex = dynamic_cast<osg::TextureBuffer*>( stateset->getTextureAttribute(*it,osg::StateAttribute::TEXTURE) );
|
||||
if(tex==NULL)
|
||||
continue;
|
||||
osg::BufferData* img =const_cast<osg::BufferData*>(tex->getBufferData());
|
||||
if(img!=NULL)
|
||||
img->dirty();
|
||||
osg::BufferData* drawcmds = tex->getBufferData();
|
||||
if(drawcmds!=NULL)
|
||||
drawcmds->dirty();
|
||||
}
|
||||
for(it=texUnitsDirtyParams.begin(), eit=texUnitsDirtyParams.end(); it!=eit; ++it)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ int main( int argc, char **argv )
|
||||
impostor->setRange(0,0.0f,1e7f);
|
||||
impostor->setCenter(bs.center());
|
||||
|
||||
// impostor specfic settings.
|
||||
// impostor specific settings.
|
||||
impostor->setImpostorThresholdToBound(5.0f);
|
||||
|
||||
model = impostor;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&)
|
||||
{
|
||||
if (ea.getEventType() == osgGA::GUIEventAdapter::KEYUP)
|
||||
{
|
||||
@@ -238,10 +238,22 @@ int main(int argc, char** argv)
|
||||
geode->addDrawable( osg::createTexturedQuadGeometry(osg::Vec3(0.0f,characterSize*thickness,0.0f),osg::Vec3(characterSize,0.0,0.0),osg::Vec3(0.0f,0.0,characterSize), 0.0, 0.0, 1.0, 1.0) );
|
||||
}
|
||||
|
||||
if (arguments.read("--add-axes"))
|
||||
group->addChild(osgDB::readNodeFile("axes.osgt"));
|
||||
|
||||
std::string mode;
|
||||
if (arguments.read("--character-size-mode", mode))
|
||||
{
|
||||
if (mode == "screen_coords")
|
||||
{
|
||||
text3D->setCharacterSizeMode(osgText::TextBase::SCREEN_COORDS);
|
||||
text3D->setCharacterSize(1080/4);
|
||||
}
|
||||
}
|
||||
|
||||
viewer.addEventHandler(new Text3DAttributeHandler(text3D));
|
||||
}
|
||||
|
||||
|
||||
viewer.setSceneData(group);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -613,7 +613,7 @@ public:
|
||||
// to be deleted and re-recreated.
|
||||
//
|
||||
// The load/subload happens during the draw traversal so doesn't happen on
|
||||
// the setImage which just updates internal pointers and modifed flags.
|
||||
// the setImage which just updates internal pointers and modified flags.
|
||||
|
||||
_texture->setImage(_imageList[_currPos].get());
|
||||
|
||||
|
||||
@@ -104,9 +104,7 @@ public:
|
||||
void operator() (StateAttribute* attr, NodeVisitor* nv)
|
||||
{
|
||||
UniformBufferBinding* ubb = static_cast<UniformBufferBinding*>(attr);
|
||||
UniformBufferObject* ubo
|
||||
= static_cast<UniformBufferObject*>(ubb->getBufferObject());
|
||||
FloatArray* array = static_cast<FloatArray*>(ubo->getBufferData(0));
|
||||
FloatArray* array = static_cast<FloatArray*>(ubb->getBufferData());
|
||||
double time = nv->getFrameStamp()->getSimulationTime();
|
||||
double frac = fmod(time, 1.0);
|
||||
Vec4f warmColor = (Vec4f(0.0, 0.0, 1.0 ,1) * frac
|
||||
@@ -165,7 +163,7 @@ int main(int argc, char** argv)
|
||||
group1->addChild(loadedModel.get());
|
||||
scene->addChild(group1);
|
||||
ref_ptr<UniformBufferBinding> ubb1
|
||||
= new UniformBufferBinding(0, ubo.get(), 0, blockSize);
|
||||
= new UniformBufferBinding(0, colorArray.get(), 0, blockSize);
|
||||
ss1->setAttributeAndModes(ubb1.get(), StateAttribute::ON);
|
||||
|
||||
ref_ptr<FloatArray> colorArray2
|
||||
@@ -180,7 +178,7 @@ int main(int argc, char** argv)
|
||||
group2->addChild(loadedModel.get());
|
||||
scene->addChild(group2);
|
||||
ref_ptr<UniformBufferBinding> ubb2
|
||||
= new UniformBufferBinding(0, ubo2.get(), 0, blockSize);
|
||||
= new UniformBufferBinding(0, colorArray2.get(), 0, blockSize);
|
||||
ss2->setAttributeAndModes(ubb2.get(), StateAttribute::ON);
|
||||
|
||||
ref_ptr<FloatArray> colorArray3
|
||||
@@ -195,7 +193,7 @@ int main(int argc, char** argv)
|
||||
group3->addChild(loadedModel.get());
|
||||
scene->addChild(group3);
|
||||
ref_ptr<UniformBufferBinding> ubb3
|
||||
= new UniformBufferBinding(0, ubo3.get(), 0, blockSize);
|
||||
= new UniformBufferBinding(0, colorArray3.get(), 0, blockSize);
|
||||
ubb3->setUpdateCallback(new UniformBufferCallback);
|
||||
ubb3->setDataVariance(Object::DYNAMIC);
|
||||
ss3->setAttributeAndModes(ubb3.get(), StateAttribute::ON);
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
* This class packs a lot of functionality that you might not expect from a "Viewer".
|
||||
* The reason is that Mac users have high expectations of their applications, so things
|
||||
* that might not even be considered on other platforms (like drag-and-drop), are almost
|
||||
* a requirment on Mac OS X.
|
||||
* a requirement on Mac OS X.
|
||||
* The good news is that this class can almost be used as a template for other purposes.
|
||||
* If you are looking for the bare minimum code needed, focus your attention on
|
||||
* the init* routines and drawRect.
|
||||
@@ -782,7 +782,7 @@ A -respondsToSelector: check has been used to provide compatibility with previou
|
||||
}
|
||||
|
||||
// This is a job for Mighty Mouse!
|
||||
// For the most fluid experience turn on 360 degree mode availble in 10.4.8+.
|
||||
// For the most fluid experience turn on 360 degree mode available in 10.4.8+.
|
||||
// With your Mighty Mouse plugged in,
|
||||
// open 'Keyboard & Mouse' in 'System Preferences'.
|
||||
// Select the 'Mouse' tab.
|
||||
@@ -796,7 +796,7 @@ A -respondsToSelector: check has been used to provide compatibility with previou
|
||||
// This this call does nothing.
|
||||
// theViewer->getEventQueue()->mouseScroll2D([the_event deltaX], [the_event deltaY]);
|
||||
|
||||
// With the absense of a useful mouseScroll2D API, we can manually simulate the desired effect.
|
||||
// With the absence of a useful mouseScroll2D API, we can manually simulate the desired effect.
|
||||
NSPoint the_point = [the_event locationInWindow];
|
||||
NSPoint converted_point = [self convertPoint:the_point fromView:nil];
|
||||
theViewer->getEventQueue()->mouseButtonPress(converted_point.x, converted_point.y, 1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
* Copyright (C) 2010 Tim Moore
|
||||
* Copyright (C) 2012 David Callu
|
||||
* Copyright (C) 2017 Julien Valentin
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@@ -40,53 +41,67 @@ class OSG_EXPORT BufferIndexBinding : public StateAttribute
|
||||
{
|
||||
protected:
|
||||
BufferIndexBinding(GLenum target, GLuint index);
|
||||
BufferIndexBinding(GLenum target, GLuint index, BufferObject* bo, GLintptr offset,
|
||||
GLsizeiptr size);
|
||||
BufferIndexBinding(GLenum target, GLuint index, BufferData* bd, GLintptr offset=0, GLsizeiptr size=0);
|
||||
BufferIndexBinding(const BufferIndexBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
public:
|
||||
// The member value is part of the key to this state attribute in
|
||||
// the State class. Using the index target, we can separately
|
||||
// track the bindings for many different index targets.
|
||||
virtual unsigned getMember() const { return static_cast<unsigned int>(_index); }
|
||||
|
||||
GLenum getTarget() const { return _target; }
|
||||
///enable arbitrary BufferBinding (user is responsible for _target mismatch with bufferdata
|
||||
/// what can be done is setting wrong _target and use the one of bd if not subclassed
|
||||
void setTarget(GLenum t){_target=t;}
|
||||
|
||||
/** Set the renderbuffer index of the BlendEquationi. */
|
||||
void setIndex(unsigned int index);
|
||||
inline void setBufferData(BufferData *bufferdata) {
|
||||
if (_bufferData.valid())
|
||||
{
|
||||
_bufferData->removeClient(this);
|
||||
}
|
||||
|
||||
_bufferData=bufferdata;
|
||||
|
||||
if (_bufferData.valid())
|
||||
{
|
||||
if(!_bufferData->getBufferObject())
|
||||
_bufferData->setBufferObject(new VertexBufferObject());
|
||||
if(_size==0)
|
||||
_size=_bufferData->getTotalDataSize();
|
||||
}
|
||||
}
|
||||
/** Get the buffer data to be bound.
|
||||
*/
|
||||
inline const BufferData* getBufferData() const { return _bufferData.get(); }
|
||||
inline BufferData* getBufferData(){ return _bufferData.get(); }
|
||||
|
||||
/** Get the index target.
|
||||
*/
|
||||
unsigned int getIndex() const { return _index; }
|
||||
|
||||
/** Set the buffer object that will be bound to the index target.
|
||||
inline GLuint getIndex() const { return _index; }
|
||||
/** Set the index target. (and update parents StateSets)
|
||||
*/
|
||||
void setBufferObject(BufferObject *bo) { _bufferObject = bo; }
|
||||
void setIndex(GLuint index);
|
||||
|
||||
/** Get the buffer object to be bound.
|
||||
*/
|
||||
const BufferObject* getBufferObject() const { return _bufferObject.get(); }
|
||||
BufferObject* getBufferObject(){ return _bufferObject.get(); }
|
||||
|
||||
/** Set the starting offset into the buffer object for data for
|
||||
/** Set the starting offset into the buffer data for
|
||||
the indexed target. Note: the required alignment on the offset
|
||||
may be quite large (e.g., 256 bytes on NVidia 8600M). This
|
||||
should be checked with glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT...).
|
||||
*/
|
||||
void setOffset(GLintptr offset) { _offset = offset; }
|
||||
GLintptr getOffset() const { return _offset; }
|
||||
inline void setOffset(GLintptr offset) { _offset = offset; }
|
||||
inline GLintptr getOffset() const { return _offset; }
|
||||
|
||||
/** Set the size of data for the indexed target.
|
||||
/** Set the size override of bufferdata binded for the indexed target.
|
||||
*/
|
||||
void setSize(GLsizeiptr size) { _size = size; }
|
||||
GLsizeiptr getSize() const { return _size; }
|
||||
inline void setSize(GLsizeiptr size) { _size = size; }
|
||||
inline GLsizeiptr getSize() const { return _size; }
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
protected:
|
||||
virtual ~BufferIndexBinding();
|
||||
const GLenum _target;
|
||||
/*const*/ GLenum _target;
|
||||
ref_ptr<BufferData> _bufferData;
|
||||
GLuint _index;
|
||||
ref_ptr<BufferObject> _bufferObject;
|
||||
GLintptr _offset;
|
||||
GLsizeiptr _size;
|
||||
};
|
||||
@@ -100,21 +115,20 @@ class OSG_EXPORT UniformBufferBinding : public BufferIndexBinding
|
||||
UniformBufferBinding(GLuint index);
|
||||
/** Create a binding for a uniform buffer index target.
|
||||
* @param index the index target
|
||||
* @param bo associated buffer object
|
||||
* @param offset offset into buffer object
|
||||
* @param size size of data in buffer object
|
||||
* @param bd associated buffer data
|
||||
* @param offset offset into buffer data
|
||||
* @param size size of data in buffer data
|
||||
*/
|
||||
UniformBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size);
|
||||
UniformBufferBinding(GLuint index, BufferData* bd, GLintptr offset=0, GLsizeiptr size=0);
|
||||
UniformBufferBinding(const UniformBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
META_StateAttribute(osg, UniformBufferBinding, UNIFORMBUFFERBINDING);
|
||||
|
||||
virtual int compare(const StateAttribute& bb) const
|
||||
{
|
||||
COMPARE_StateAttribute_Types(UniformBufferBinding, bb)
|
||||
|
||||
COMPARE_StateAttribute_Parameter(_target)
|
||||
COMPARE_StateAttribute_Parameter(_index)
|
||||
COMPARE_StateAttribute_Parameter(_bufferObject)
|
||||
COMPARE_StateAttribute_Parameter(_bufferData)
|
||||
COMPARE_StateAttribute_Parameter(_offset)
|
||||
COMPARE_StateAttribute_Parameter(_size)
|
||||
return 0;
|
||||
@@ -127,17 +141,16 @@ class OSG_EXPORT TransformFeedbackBufferBinding : public BufferIndexBinding
|
||||
{
|
||||
public:
|
||||
TransformFeedbackBufferBinding(GLuint index = 0);
|
||||
TransformFeedbackBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size);
|
||||
TransformFeedbackBufferBinding(GLuint index, BufferData* bd, GLintptr offset=0, GLsizeiptr size=0);
|
||||
TransformFeedbackBufferBinding(const TransformFeedbackBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
META_StateAttribute(osg, TransformFeedbackBufferBinding, TRANSFORMFEEDBACKBUFFERBINDING);
|
||||
|
||||
virtual int compare(const StateAttribute& bb) const
|
||||
{
|
||||
COMPARE_StateAttribute_Types(TransformFeedbackBufferBinding, bb)
|
||||
|
||||
COMPARE_StateAttribute_Parameter(_target)
|
||||
COMPARE_StateAttribute_Parameter(_index)
|
||||
COMPARE_StateAttribute_Parameter(_bufferObject)
|
||||
COMPARE_StateAttribute_Parameter(_bufferData)
|
||||
COMPARE_StateAttribute_Parameter(_offset)
|
||||
COMPARE_StateAttribute_Parameter(_size)
|
||||
return 0;
|
||||
@@ -152,11 +165,11 @@ class OSG_EXPORT AtomicCounterBufferBinding : public BufferIndexBinding
|
||||
AtomicCounterBufferBinding(GLuint index=0);
|
||||
/** Create a binding for a atomic counter buffer index target.
|
||||
* @param index the index target
|
||||
* @param bo associated buffer object
|
||||
* @param offset offset into buffer object
|
||||
* @param size size of data in buffer object
|
||||
* @param bd associated buffer data
|
||||
* @param offset offset into buffer data
|
||||
* @param size size of data in buffer data
|
||||
*/
|
||||
AtomicCounterBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size);
|
||||
AtomicCounterBufferBinding(GLuint index, BufferData* bd, GLintptr offset=0, GLsizeiptr size=0);
|
||||
AtomicCounterBufferBinding(const AtomicCounterBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
META_StateAttribute(osg, AtomicCounterBufferBinding, ATOMICCOUNTERBUFFERBINDING);
|
||||
|
||||
@@ -165,10 +178,9 @@ class OSG_EXPORT AtomicCounterBufferBinding : public BufferIndexBinding
|
||||
virtual int compare(const StateAttribute& bb) const
|
||||
{
|
||||
COMPARE_StateAttribute_Types(AtomicCounterBufferBinding, bb)
|
||||
|
||||
COMPARE_StateAttribute_Parameter(_target)
|
||||
COMPARE_StateAttribute_Parameter(_index)
|
||||
COMPARE_StateAttribute_Parameter(_bufferObject)
|
||||
COMPARE_StateAttribute_Parameter(_bufferData)
|
||||
COMPARE_StateAttribute_Parameter(_offset)
|
||||
COMPARE_StateAttribute_Parameter(_size)
|
||||
return 0;
|
||||
@@ -181,11 +193,11 @@ class OSG_EXPORT ShaderStorageBufferBinding : public BufferIndexBinding
|
||||
ShaderStorageBufferBinding(GLuint index=0);
|
||||
/** Create a binding for a shader storage buffer index target.
|
||||
* @param index the index target
|
||||
* @param bo associated buffer object
|
||||
* @param offset offset into buffer object
|
||||
* @param size size of data in buffer object
|
||||
* @param bd associated buffer data
|
||||
* @param offset offset into buffer data
|
||||
* @param size size of data in buffer data
|
||||
*/
|
||||
ShaderStorageBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size);
|
||||
ShaderStorageBufferBinding(GLuint index, BufferData* bd, GLintptr offset=0, GLsizeiptr size=0);
|
||||
ShaderStorageBufferBinding(const ShaderStorageBufferBinding& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
META_StateAttribute(osg, ShaderStorageBufferBinding, SHADERSTORAGEBUFFERBINDING);
|
||||
|
||||
@@ -194,7 +206,7 @@ class OSG_EXPORT ShaderStorageBufferBinding : public BufferIndexBinding
|
||||
COMPARE_StateAttribute_Types(ShaderStorageBufferBinding, bb)
|
||||
COMPARE_StateAttribute_Parameter(_target)
|
||||
COMPARE_StateAttribute_Parameter(_index)
|
||||
COMPARE_StateAttribute_Parameter(_bufferObject)
|
||||
COMPARE_StateAttribute_Parameter(_bufferData)
|
||||
COMPARE_StateAttribute_Parameter(_offset)
|
||||
COMPARE_StateAttribute_Parameter(_size)
|
||||
return 0;
|
||||
|
||||
@@ -72,7 +72,7 @@ class OSG_EXPORT Callback : public virtual Object {
|
||||
|
||||
/** Invoke the callback, first parameter is the Object that the callback is attached to,
|
||||
* the second parameter, the data, is typically the NodeVisitor that is invoking the callback.
|
||||
* The run(..) method may be overriden by users directly, or if the user is using one of the old
|
||||
* The run(..) method may be overridden by users directly, or if the user is using one of the old
|
||||
* style callbacks such as NodeCallback or Drawable::UpdateCallback then you can just override
|
||||
* the appropriate callback method on those callback subclasses.
|
||||
* If you are implementing your own callback then one should call traverse() to make sure nested callbacks
|
||||
|
||||
@@ -692,10 +692,6 @@ namespace osg
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(OSG_GLES1_FEATURES) || defined(OSG_GLES2_FEATURES)|| defined(OSG_GLES3_FEATURES)
|
||||
typedef double GLclampd;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -557,7 +557,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isSGIXMinMaxSupported;
|
||||
bool isLogicOpSupported;
|
||||
|
||||
void (GL_APIENTRY * glBlendColor) (GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha);
|
||||
void (GL_APIENTRY * glBlendColor) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
void (GL_APIENTRY * glBlendEquation)(GLenum mode);
|
||||
void (GL_APIENTRY * glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
|
||||
void (GL_APIENTRY * glBlendEquationi)(GLuint buf, GLenum mode);
|
||||
@@ -599,7 +599,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isMultisampleSupported;
|
||||
bool isMultisampleFilterHintSupported;
|
||||
|
||||
void (GL_APIENTRY * glSampleCoverage) (GLclampf value, GLboolean invert);
|
||||
void (GL_APIENTRY * glSampleCoverage) (GLfloat value, GLboolean invert);
|
||||
|
||||
|
||||
// Point
|
||||
@@ -725,8 +725,9 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
void (GL_APIENTRY * glScissorArrayv) (GLuint first, GLsizei count, const GLint * v);
|
||||
void (GL_APIENTRY * glScissorIndexed) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
|
||||
void (GL_APIENTRY * glScissorIndexedv) (GLuint index, const GLint * v);
|
||||
void (GL_APIENTRY * glDepthRangeArrayv) (GLuint first, GLsizei count, const GLclampd * v);
|
||||
void (GL_APIENTRY * glDepthRangeIndexed) (GLuint index, GLclampd n, GLclampd f);
|
||||
void (GL_APIENTRY * glDepthRangeArrayv) (GLuint first, GLsizei count, const GLdouble * v);
|
||||
void (GL_APIENTRY * glDepthRangeIndexed) (GLuint index, GLdouble n, GLdouble f);
|
||||
void (GL_APIENTRY * glDepthRangeIndexedf) (GLuint index, GLfloat n, GLfloat f);
|
||||
void (GL_APIENTRY * glGetFloati_v) (GLenum target, GLuint index, GLfloat *data);
|
||||
void (GL_APIENTRY * glGetDoublei_v) (GLenum target, GLuint index, GLdouble *data);
|
||||
|
||||
@@ -747,7 +748,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
// debug extensions
|
||||
void (GL_APIENTRY * glObjectLabel) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label);
|
||||
|
||||
/** convinience wrapper around glObjectLabel that calls glObjectLabel if it's supported and using std::string as a label parameter.*/
|
||||
/** convenience wrapper around glObjectLabel that calls glObjectLabel if it's supported and using std::string as a label parameter.*/
|
||||
void debugObjectLabel(GLenum identifier, GLuint name, const std::string& label) const { if (glObjectLabel && !label.empty()) glObjectLabel(identifier, name, label.size(), label.c_str()); }
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class OSG_EXPORT Geometry : public Drawable
|
||||
unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const;
|
||||
|
||||
|
||||
/** Convinience method that checks all the vertex arrays to make sure that the buffer objects are all assigned appropriate.*/
|
||||
/** Convenience method that checks all the vertex arrays to make sure that the buffer objects are all assigned appropriate.*/
|
||||
void configureBufferObjects();
|
||||
|
||||
/** return true if any arrays are shared.*/
|
||||
@@ -279,7 +279,7 @@ class OSG_EXPORT Geometry : public Drawable
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Convinience visitor for making sure that any BufferObjects that might be required are set up in the scene graph.*/
|
||||
/** Convenience visitor for making sure that any BufferObjects that might be required are set up in the scene graph.*/
|
||||
class ConfigureBufferObjectsVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -242,6 +242,12 @@ class OSG_EXPORT Matrixd
|
||||
/** full 4x4 matrix invert. */
|
||||
bool invert_4x4( const Matrixd& rhs);
|
||||
|
||||
/** transpose a matrix */
|
||||
bool transpose(const Matrixd&rhs);
|
||||
|
||||
/** transpose orthogonal part of the matrix **/
|
||||
bool transpose3x3(const Matrixd&rhs);
|
||||
|
||||
/** ortho-normalize the 3x3 rotation & scale matrix */
|
||||
void orthoNormalize(const Matrixd& rhs);
|
||||
|
||||
|
||||
@@ -242,6 +242,12 @@ class OSG_EXPORT Matrixf
|
||||
/** full 4x4 matrix invert. */
|
||||
bool invert_4x4( const Matrixf& rhs);
|
||||
|
||||
/** transpose matrix **/
|
||||
bool transpose(const Matrixf&rhs);
|
||||
|
||||
/** transpose orthogonal part of the matrix **/
|
||||
bool transpose3x3(const Matrixf&rhs);
|
||||
|
||||
/** ortho-normalize the 3x3 rotation & scale matrix */
|
||||
void orthoNormalize(const Matrixf& rhs);
|
||||
|
||||
|
||||
@@ -747,7 +747,7 @@ class TessellationHints : public Object
|
||||
// forward declare;
|
||||
class Geometry;
|
||||
|
||||
/** Convinience class for populating an Geomtry with vertex, normals, texture coords and primitives that can render a Shape. */
|
||||
/** Convenience class for populating an Geomtry with vertex, normals, texture coords and primitives that can render a Shape. */
|
||||
class OSG_EXPORT BuildShapeGeometryVisitor : public ConstShapeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1502,7 +1502,7 @@ inline void State::pushDefineList(DefineMap& defineMap,const StateSet::DefineLis
|
||||
dv.push_back(StateSet::DefinePair(aitr->second.first,aitr->second.second));
|
||||
|
||||
// if the back of the stack has changed since the last then mark it as changed.
|
||||
bool changed = (dv[dv.size()-2].first==dv[dv.size()-1].first);
|
||||
bool changed = (dv[dv.size()-2] != dv.back());
|
||||
if (changed)
|
||||
{
|
||||
ds.changed = true;
|
||||
@@ -1571,7 +1571,7 @@ inline void State::popDefineList(DefineMap& defineMap,const StateSet::DefineList
|
||||
if (!dv.empty())
|
||||
{
|
||||
// if the stack has less than 2 entries or new back vs old back are different then mark the DefineStack as changed
|
||||
if ((dv.size()<2) || (dv[dv.size()-2].first!=dv.back().first))
|
||||
if ((dv.size() < 2) || (dv[dv.size()-2] != dv.back()))
|
||||
{
|
||||
ds.changed = true;
|
||||
defineMap.changed = true;
|
||||
|
||||
@@ -56,7 +56,7 @@ class OSG_EXPORT Timer {
|
||||
inline double time_n() const { return delta_n(_startTick, tick()); }
|
||||
|
||||
/** Get the time in seconds between timer ticks t1 and t2.*/
|
||||
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerTick; }
|
||||
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (t2>t1) ? (double)(t2 - t1)*_secsPerTick : -(double)(t1 - t2)*_secsPerTick; }
|
||||
|
||||
/** Get the time in milliseconds between timer ticks t1 and t2.*/
|
||||
inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace osgParticle
|
||||
virtual const char* className() const { return "Interpolator"; }
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Interpolator* >(obj) != 0; }
|
||||
|
||||
/// Interpolate between floats. Must be overriden in descendant classes.
|
||||
/// Interpolate between floats. Must be overridden in descendant classes.
|
||||
virtual float interpolate(float t, float y1, float y2) const = 0;
|
||||
|
||||
/// Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separately.
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace osgParticle
|
||||
/// Implementation of <CODE>ParticleProcessor::process()</CODE>. Do not call this method by yourself.
|
||||
inline void process(double dt);
|
||||
|
||||
/// Execute the program on the particle system. Must be overriden in descendant classes.
|
||||
/// Execute the program on the particle system. Must be overridden in descendant classes.
|
||||
virtual void execute(double dt) = 0;
|
||||
|
||||
private:
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgParticle
|
||||
virtual const char* className() const { return "Shooter"; }
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Shooter *>(obj) != 0; }
|
||||
|
||||
/** Shoot a particle. Must be overriden by descendants.
|
||||
/** Shoot a particle. Must be overridden by descendants.
|
||||
This method should only set the velocity vector of particle <CODE>P</CODE>, leaving other
|
||||
attributes unchanged.
|
||||
*/
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
namespace osgShadow {
|
||||
|
||||
/**
|
||||
Class used as a layer for debuging resources used by derived xxxShadowMap classes.
|
||||
Class used as a layer for debugging resources used by derived xxxShadowMap classes.
|
||||
As designed by its base ViewDepndentShadowTechnique, DebugShadowMap serves mainly as container of
|
||||
DebugShadowMap::ViewData objects. Most of the debuging support work is done by these objects.
|
||||
DebugShadowMap::ViewData objects. Most of the debugging support work is done by these objects.
|
||||
DebugShadowMap technique only initializes them in initViewDependentData method.
|
||||
|
||||
Debuging outputs present:
|
||||
Debugging outputs present:
|
||||
Shadow maps (pseudo colored to improve readability)
|
||||
Shadow and related volumes (represented as convex polyhedra)
|
||||
*/
|
||||
@@ -65,16 +65,16 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
|
||||
/** Declaration of standard OSG object methods */
|
||||
META_Object( osgShadow, DebugShadowMap );
|
||||
|
||||
/** Turn on/off debuging hud & rendering of debug volumes in main view */
|
||||
/** Turn on/off debugging hud & rendering of debug volumes in main view */
|
||||
void setDebugDraw( bool draw ) { _doDebugDraw = draw; }
|
||||
|
||||
/** Tell if debuging hud & rendering of debug volumes is active */
|
||||
/** Tell if debugging hud & rendering of debug volumes is active */
|
||||
bool getDebugDraw( void ) const { return _doDebugDraw; }
|
||||
|
||||
/** Get the file name of debuging dump */
|
||||
/** Get the file name of debugging dump */
|
||||
std::string getDebugDump( void ) const { return _debugDump; }
|
||||
|
||||
/** Set the file name of debuging dump */
|
||||
/** Set the file name of debugging dump */
|
||||
void setDebugDump( const std::string & debugDumpFile ) { _debugDump = debugDumpFile; }
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
class OSGSHADOW_EXPORT FragmentShaderGenerator : public osg::Referenced {
|
||||
public:
|
||||
/**
|
||||
* generate the GLSL fragement shader
|
||||
* generate the GLSL fragment shader
|
||||
*/
|
||||
virtual std::string generateGLSL_FragmentShader_BaseTex(bool debug, unsigned int splitCount,double textureRes, bool filtered, unsigned int nbrSplits,unsigned int textureOffset);
|
||||
};
|
||||
|
||||
@@ -82,13 +82,13 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
|
||||
/** return true, osgText::Text does support accept(ConstAttributeFunctor&).*/
|
||||
virtual bool supports(const osg::Drawable::ConstAttributeFunctor&) const { return false; }
|
||||
|
||||
/** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** accept an ConstAttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has.*/
|
||||
virtual void accept(osg::Drawable::ConstAttributeFunctor& af) const;
|
||||
|
||||
/** return true, osgText::Text does support accept(PrimitiveFunctor&) .*/
|
||||
virtual bool supports(const osg::PrimitiveFunctor&) const { return false; }
|
||||
|
||||
/** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/
|
||||
/** accept a PrimtiveFunctor and call its methods to tell it about the internal primtives that this Drawable has.*/
|
||||
virtual void accept(osg::PrimitiveFunctor& pf) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
|
||||
@@ -325,12 +325,12 @@ protected:
|
||||
osg::Vec4 _textBBColor;
|
||||
KerningType _kerningType;
|
||||
unsigned int _lineCount;
|
||||
bool _glyphNormalized;
|
||||
|
||||
osg::Vec3 _offset;
|
||||
osg::Vec3 _normal;
|
||||
osg::BoundingBox _textBB;
|
||||
|
||||
|
||||
mutable osg::Matrix _matrix;
|
||||
|
||||
Primitives _decorationPrimitives;
|
||||
|
||||
@@ -31,7 +31,7 @@ class OSGUTIL_EXPORT DrawElementTypeSimplifier
|
||||
class OSGUTIL_EXPORT DrawElementTypeSimplifierVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
DrawElementTypeSimplifierVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ) {}
|
||||
META_NodeVisitor(osgUtil, DrawElementTypeSimplifierVisitor);
|
||||
|
||||
void apply(osg::Geometry& geom);
|
||||
|
||||
@@ -460,8 +460,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
|
||||
/** Do init traversal of the attached scene graph using Init NodeVisitor.
|
||||
* The init traversal is called once for each SceneView, and should
|
||||
* be used to compile display lists, texture objects and intialize data
|
||||
* not otherwise intialized during scene graph loading. Note, is
|
||||
* be used to compile display lists, texture objects and initialize data
|
||||
* not otherwise initialized during scene graph loading. Note, is
|
||||
* called automatically by update & cull if it hasn't already been called
|
||||
* elsewhere. Also init() should only ever be called within a valid
|
||||
* graphics context.*/
|
||||
|
||||
@@ -37,6 +37,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
|
||||
_parent(0),
|
||||
_window(0),
|
||||
_visualInfo(0),
|
||||
_fbConfig(0),
|
||||
#ifdef OSG_USE_EGL
|
||||
_eglDisplay(0),
|
||||
_eglSurface(0),
|
||||
@@ -176,6 +177,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
|
||||
Window _parent;
|
||||
Window _window;
|
||||
XVisualInfo* _visualInfo;
|
||||
GLXFBConfig _fbConfig;
|
||||
|
||||
#ifdef OSG_USE_EGL
|
||||
EGLDisplay _eglDisplay;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
* Copyright (C) 2010 Tim Moore
|
||||
* Copyright (C) 2012 David Callu
|
||||
* Copyright (C) 2017 Julien Valentin
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@@ -18,25 +19,31 @@
|
||||
|
||||
#include <string.h> // for memcpy
|
||||
|
||||
#ifndef GL_DRAW_INDIRECT_BUFFER
|
||||
#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
|
||||
BufferIndexBinding::BufferIndexBinding(GLenum target, GLuint index)
|
||||
: _target(target), _index(index), _offset(0), _size(0)
|
||||
:_target(target), _bufferData(0), _index(index), _offset(0), _size(0)
|
||||
{
|
||||
}
|
||||
|
||||
BufferIndexBinding::BufferIndexBinding(GLenum target, GLuint index, BufferObject* bo,
|
||||
BufferIndexBinding::BufferIndexBinding(GLenum target, GLuint index, BufferData* bo,
|
||||
GLintptr offset, GLsizeiptr size)
|
||||
: _target(target), _index(index), _bufferObject(bo), _offset(offset), _size(size)
|
||||
: _target(target), _index(index), _offset(offset), _size(size)
|
||||
{
|
||||
setBufferData(bo);
|
||||
}
|
||||
|
||||
BufferIndexBinding::BufferIndexBinding(const BufferIndexBinding& rhs, const CopyOp& copyop)
|
||||
: StateAttribute(rhs, copyop),
|
||||
_target(rhs._target), _index(rhs._index),
|
||||
_bufferObject(static_cast<BufferObject*>(copyop(rhs._bufferObject.get()))),
|
||||
_offset(rhs._offset),
|
||||
_size(rhs._size)
|
||||
BufferIndexBinding::BufferIndexBinding(const BufferIndexBinding& rhs, const CopyOp& copyop):StateAttribute(rhs,copyop),
|
||||
_target(rhs._target),
|
||||
_bufferData(static_cast<BufferData*>(copyop(rhs._bufferData.get()))),
|
||||
_index(rhs._index),
|
||||
_offset(rhs._offset),
|
||||
_size(rhs._size)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,15 +62,13 @@ void BufferIndexBinding::setIndex(unsigned int index)
|
||||
|
||||
void BufferIndexBinding::apply(State& state) const
|
||||
{
|
||||
if (_bufferObject.valid())
|
||||
if (_bufferData.valid())
|
||||
{
|
||||
GLBufferObject* glObject
|
||||
= _bufferObject->getOrCreateGLBufferObject(state.getContextID());
|
||||
if (!glObject->_extensions->isUniformBufferObjectSupported)
|
||||
return;
|
||||
= _bufferData->getBufferObject()->getOrCreateGLBufferObject(state.getContextID());
|
||||
if (glObject->isDirty()) glObject->compileBuffer();
|
||||
glObject->_extensions->glBindBufferRange(_target, _index,
|
||||
glObject->getGLObjectID(), _offset, _size);
|
||||
glObject->getGLObjectID(), glObject->getOffset(_bufferData->getBufferIndex())+_offset, _size-_offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,30 +78,30 @@ UniformBufferBinding::UniformBufferBinding()
|
||||
}
|
||||
|
||||
UniformBufferBinding::UniformBufferBinding(GLuint index)
|
||||
: BufferIndexBinding(GL_UNIFORM_BUFFER, index)
|
||||
: BufferIndexBinding(GL_UNIFORM_BUFFER, index)
|
||||
{
|
||||
}
|
||||
|
||||
UniformBufferBinding::UniformBufferBinding(GLuint index, BufferObject* bo, GLintptr offset,
|
||||
GLsizeiptr size)
|
||||
UniformBufferBinding::UniformBufferBinding(GLuint index, BufferData* bo, GLintptr offset,
|
||||
GLsizeiptr size)
|
||||
: BufferIndexBinding(GL_UNIFORM_BUFFER, index, bo, offset, size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UniformBufferBinding::UniformBufferBinding(const UniformBufferBinding& rhs,
|
||||
const CopyOp& copyop)
|
||||
const CopyOp& copyop)
|
||||
: BufferIndexBinding(rhs, copyop)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TransformFeedbackBufferBinding::TransformFeedbackBufferBinding(GLuint index)
|
||||
: BufferIndexBinding(GL_TRANSFORM_FEEDBACK_BUFFER, index)
|
||||
: BufferIndexBinding(GL_TRANSFORM_FEEDBACK_BUFFER, index)
|
||||
{
|
||||
}
|
||||
|
||||
TransformFeedbackBufferBinding::TransformFeedbackBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size)
|
||||
TransformFeedbackBufferBinding::TransformFeedbackBufferBinding(GLuint index, BufferData* bo, GLintptr offset, GLsizeiptr size)
|
||||
: BufferIndexBinding(GL_TRANSFORM_FEEDBACK_BUFFER, index, bo, offset, size)
|
||||
{
|
||||
|
||||
@@ -109,11 +114,11 @@ TransformFeedbackBufferBinding::TransformFeedbackBufferBinding(const TransformFe
|
||||
|
||||
|
||||
AtomicCounterBufferBinding::AtomicCounterBufferBinding(GLuint index)
|
||||
: BufferIndexBinding(GL_ATOMIC_COUNTER_BUFFER, index)
|
||||
: BufferIndexBinding(GL_ATOMIC_COUNTER_BUFFER, index)
|
||||
{
|
||||
}
|
||||
|
||||
AtomicCounterBufferBinding::AtomicCounterBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size)
|
||||
AtomicCounterBufferBinding::AtomicCounterBufferBinding(GLuint index, BufferData* bo, GLintptr offset, GLsizeiptr size)
|
||||
: BufferIndexBinding(GL_ATOMIC_COUNTER_BUFFER, index, bo, offset, size)
|
||||
{
|
||||
|
||||
@@ -126,9 +131,9 @@ AtomicCounterBufferBinding::AtomicCounterBufferBinding(const AtomicCounterBuffer
|
||||
|
||||
void AtomicCounterBufferBinding::readData(osg::State & state, osg::UIntArray & uintArray) const
|
||||
{
|
||||
if (!_bufferObject) return;
|
||||
if (!_bufferData) return;
|
||||
|
||||
GLBufferObject* bo = _bufferObject->getOrCreateGLBufferObject( state.getContextID() );
|
||||
GLBufferObject* bo = _bufferData->getBufferObject()->getOrCreateGLBufferObject( state.getContextID() );
|
||||
if (!bo) return;
|
||||
|
||||
|
||||
@@ -139,7 +144,7 @@ void AtomicCounterBufferBinding::readData(osg::State & state, osg::UIntArray & u
|
||||
bo->_extensions->glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bo->getGLObjectID());
|
||||
|
||||
GLubyte* src = (GLubyte*)bo->_extensions->glMapBuffer(GL_ATOMIC_COUNTER_BUFFER,
|
||||
GL_READ_ONLY_ARB);
|
||||
GL_READ_ONLY_ARB);
|
||||
if(src)
|
||||
{
|
||||
size_t size = osg::minimum<int>(_size, uintArray.getTotalDataSize());
|
||||
@@ -157,7 +162,7 @@ ShaderStorageBufferBinding::ShaderStorageBufferBinding(GLuint index)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderStorageBufferBinding::ShaderStorageBufferBinding(GLuint index, BufferObject* bo, GLintptr offset, GLsizeiptr size)
|
||||
ShaderStorageBufferBinding::ShaderStorageBufferBinding(GLuint index, BufferData* bo, GLintptr offset, GLsizeiptr size)
|
||||
: BufferIndexBinding(GL_SHADER_STORAGE_BUFFER, index, bo, offset, size)
|
||||
{
|
||||
|
||||
@@ -168,4 +173,5 @@ ShaderStorageBufferBinding::ShaderStorageBufferBinding(const ShaderStorageBuffer
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} // namespace osg
|
||||
|
||||
@@ -41,7 +41,11 @@ void DepthRangeIndexed::apply(State& state) const
|
||||
const GLExtensions* extensions = state.get<GLExtensions>();
|
||||
if (extensions->glDepthRangeIndexed)
|
||||
{
|
||||
extensions->glDepthRangeIndexed(static_cast<GLuint>(_index), static_cast<GLclampd>(_zNear), static_cast<GLclampd>(_zFar));
|
||||
extensions->glDepthRangeIndexed(static_cast<GLuint>(_index), static_cast<GLdouble>(_zNear), static_cast<GLdouble>(_zFar));
|
||||
}
|
||||
else if (extensions->glDepthRangeIndexedf)
|
||||
{
|
||||
extensions->glDepthRangeIndexedf(static_cast<GLuint>(_index), static_cast<GLfloat>(_zNear), static_cast<GLfloat>(_zFar));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -817,7 +817,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
|
||||
if (arguments.getApplicationUsage())
|
||||
{
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--display <type>","MONITOR | POWERWALL | REALITY_CENTER | HEAD_MOUNTED_DISPLAY");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--stereo","Use default stereo mode which is ANAGLYPHIC if not overriden by environmental variable");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--stereo","Use default stereo mode which is ANAGLYPHIC if not overridden by environmental variable");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--stereo <mode>","ANAGLYPHIC | QUAD_BUFFER | HORIZONTAL_SPLIT | VERTICAL_SPLIT | LEFT_EYE | RIGHT_EYE | HORIZONTAL_INTERLACE | VERTICAL_INTERLACE | CHECKERBOARD | ON | OFF ");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--rgba","Request a RGBA color buffer visual");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--stencil","Request a stencil buffer visual");
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
// Emscripten ships EGL, which we use to get OpenGL function addresses.
|
||||
#include <EGL/egl.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
@@ -407,6 +410,10 @@ OSG_INIT_SINGLETON_PROXY(GLExtensionDisableStringInitializationProxy, osg::getGL
|
||||
|
||||
return dlsym(RTLD_DEFAULT, funcName);
|
||||
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
// Use EGL to get OpenGL function address for Emscripten.
|
||||
return convertPointerType<void*, __eglMustCastToProperFunctionPointerType>(eglGetProcAddress(funcName));
|
||||
|
||||
#else // all other unixes
|
||||
|
||||
return dlsym(0, funcName);
|
||||
@@ -1164,6 +1171,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
osg::setGLExtensionFuncPtr(glScissorIndexedv, "glScissorIndexedv", validContext);
|
||||
osg::setGLExtensionFuncPtr(glDepthRangeArrayv, "glDepthRangeArrayv", validContext);
|
||||
osg::setGLExtensionFuncPtr(glDepthRangeIndexed, "glDepthRangeIndexed", validContext);
|
||||
osg::setGLExtensionFuncPtr(glDepthRangeIndexedf, "glDepthRangeIndexedfOES", "glDepthRangeIndexedfNV", validContext);
|
||||
osg::setGLExtensionFuncPtr(glGetFloati_v, "glGetFloati_v", validContext);
|
||||
osg::setGLExtensionFuncPtr(glGetDoublei_v, "glGetDoublei_v", validContext);
|
||||
osg::setGLExtensionFuncPtr(glGetIntegerIndexedvEXT, "glGetIntegerIndexedvEXT", validContext);
|
||||
|
||||
@@ -791,6 +791,9 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
if ((*itr)->getBufferObject()) bufferObjects.insert((*itr)->getBufferObject());
|
||||
}
|
||||
|
||||
if (bufferObjects.empty())
|
||||
return; // no buffers, nothing to compile
|
||||
|
||||
//osg::ElapsedTime timer;
|
||||
|
||||
// now compile any buffer objects that require it.
|
||||
@@ -808,11 +811,7 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
|
||||
// OSG_NOTICE<<"Time to compile "<<timer.elapsedTime_m()<<"ms"<<std::endl;
|
||||
|
||||
// unbind the BufferObjects
|
||||
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
|
||||
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
|
||||
|
||||
if (state.useVertexArrayObject(_useVertexArrayObject) && !bufferObjects.empty())
|
||||
if (state.useVertexArrayObject(_useVertexArrayObject))
|
||||
{
|
||||
VertexArrayState* vas = 0;
|
||||
|
||||
@@ -826,6 +825,10 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
|
||||
state.unbindVertexArrayObject();
|
||||
}
|
||||
|
||||
// unbind the BufferObjects
|
||||
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
|
||||
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1156,8 +1159,6 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe
|
||||
(*normals)[0].normalize();
|
||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
DrawElementsUByte* elems = new DrawElementsUByte(PrimitiveSet::TRIANGLES);
|
||||
elems->push_back(0);
|
||||
elems->push_back(1);
|
||||
@@ -1167,9 +1168,6 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe
|
||||
elems->push_back(3);
|
||||
elems->push_back(0);
|
||||
geom->addPrimitiveSet(elems);
|
||||
#else
|
||||
geom->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS,0,4));
|
||||
#endif
|
||||
|
||||
return geom;
|
||||
}
|
||||
|
||||
@@ -742,6 +742,41 @@ inline T SGL_ABS(T a)
|
||||
#define SGL_SWAP(a,b,temp) ((temp)=(a),(a)=(b),(b)=(temp))
|
||||
#endif
|
||||
|
||||
bool Matrix_implementation::transpose(const Matrix_implementation&mat){
|
||||
if (&mat==this) {
|
||||
Matrix_implementation tm(mat);
|
||||
return transpose(tm);
|
||||
}
|
||||
_mat[0][1]=mat._mat[1][0];
|
||||
_mat[0][2]=mat._mat[2][0];
|
||||
_mat[0][3]=mat._mat[3][0];
|
||||
_mat[1][0]=mat._mat[0][1];
|
||||
_mat[1][2]=mat._mat[2][1];
|
||||
_mat[1][3]=mat._mat[3][1];
|
||||
_mat[2][0]=mat._mat[0][2];
|
||||
_mat[2][1]=mat._mat[1][2];
|
||||
_mat[2][3]=mat._mat[3][2];
|
||||
_mat[3][0]=mat._mat[0][3];
|
||||
_mat[3][1]=mat._mat[1][3];
|
||||
_mat[3][2]=mat._mat[2][3];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matrix_implementation::transpose3x3(const Matrix_implementation&mat){
|
||||
if (&mat==this) {
|
||||
Matrix_implementation tm(mat);
|
||||
return transpose3x3(tm);
|
||||
}
|
||||
_mat[0][1]=mat._mat[1][0];
|
||||
_mat[0][2]=mat._mat[2][0];
|
||||
_mat[1][0]=mat._mat[0][1];
|
||||
_mat[1][2]=mat._mat[2][1];
|
||||
_mat[2][0]=mat._mat[0][2];
|
||||
_mat[2][1]=mat._mat[1][2];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matrix_implementation::invert_4x4( const Matrix_implementation& mat )
|
||||
{
|
||||
if (&mat==this) {
|
||||
@@ -763,7 +798,7 @@ bool Matrix_implementation::invert_4x4( const Matrix_implementation& mat )
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
big=0.0;
|
||||
for (j=0; j<4; j++)
|
||||
for (j=0; j<4; ++j)
|
||||
if (ipiv[j] != 1)
|
||||
for (k=0; k<4; k++)
|
||||
{
|
||||
@@ -781,7 +816,7 @@ bool Matrix_implementation::invert_4x4( const Matrix_implementation& mat )
|
||||
}
|
||||
++(ipiv[icol]);
|
||||
if (irow != icol)
|
||||
for (l=0; l<4; l++) SGL_SWAP(operator()(irow,l),
|
||||
for (l=0; l<4; ++l) SGL_SWAP(operator()(irow,l),
|
||||
operator()(icol,l),
|
||||
temp);
|
||||
|
||||
@@ -792,13 +827,13 @@ bool Matrix_implementation::invert_4x4( const Matrix_implementation& mat )
|
||||
|
||||
pivinv = 1.0/operator()(icol,icol);
|
||||
operator()(icol,icol) = 1;
|
||||
for (l=0; l<4; l++) operator()(icol,l) *= pivinv;
|
||||
for (ll=0; ll<4; ll++)
|
||||
for (l=0; l<4; ++l) operator()(icol,l) *= pivinv;
|
||||
for (ll=0; ll<4; ++ll)
|
||||
if (ll != icol)
|
||||
{
|
||||
dum=operator()(ll,icol);
|
||||
operator()(ll,icol) = 0;
|
||||
for (l=0; l<4; l++) operator()(ll,l) -= operator()(icol,l)*dum;
|
||||
for (l=0; l<4; ++l) operator()(ll,l) -= operator()(icol,l)*dum;
|
||||
}
|
||||
}
|
||||
for (int lx=4; lx>0; --lx)
|
||||
|
||||
@@ -61,6 +61,9 @@ struct NotifyStreamBuffer : public std::stringbuf
|
||||
{
|
||||
NotifyStreamBuffer() : _severity(osg::NOTICE)
|
||||
{
|
||||
/* reduce the need to reallocate the std::ostream buffer behind osg::Notify (causing multitreading issues) by pre-allocating 4095 bytes */
|
||||
str(std::string(4095, 0));
|
||||
pubseekpos(0, std::ios_base::out);
|
||||
}
|
||||
|
||||
void setNotifyHandler(osg::NotifyHandler *handler) { _handler = handler; }
|
||||
|
||||
@@ -1634,7 +1634,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const
|
||||
{
|
||||
case(GL_INTENSITY) : internalFormat = GL_RED; break; // should it be swizzled to match RGBA(INTENSITY, INTENSITY, INTENSITY, INTENSITY)?
|
||||
case(GL_LUMINANCE) : internalFormat = GL_RED; break; // should it be swizzled to match RGBA(LUMINANCE, LUMINANCE, LUMINANCE, 1.0)?
|
||||
case(1) : internalFormat = GL_RED; break; // or sould this be GL_ALPHA?
|
||||
case(1) : internalFormat = GL_RED; break; // or should this be GL_ALPHA?
|
||||
case(2) : internalFormat = GL_RG; break; // should we assume GL_LUMINANCE_ALPHA?
|
||||
case(GL_LUMINANCE_ALPHA) : internalFormat = GL_RG; break; // should it be swizlled to match RGAB(LUMUNIANCE, LUMINANCE, LUMINANCE, ALPHA)?
|
||||
case(3) : internalFormat = GL_RGB; break;
|
||||
|
||||
@@ -63,7 +63,7 @@ void TextureBuffer::setBufferData(BufferData *bufferdata)
|
||||
{
|
||||
_bufferData->addClient(this);
|
||||
|
||||
///set BufferObject if not setted by user
|
||||
///set BufferObject if not set by user
|
||||
if(!_bufferData->getBufferObject())
|
||||
{
|
||||
VertexBufferObject* bo=new VertexBufferObject();
|
||||
|
||||
@@ -162,7 +162,7 @@ ENDIF()
|
||||
IF( ZLIB_FOUND )
|
||||
ADD_DEFINITIONS( -DUSE_ZLIB )
|
||||
INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} )
|
||||
SET(COMPRESSION_LIBRARIES ZLIB_LIBRARY)
|
||||
SET(COMPRESSION_LIBRARIES ZLIB_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -95,6 +95,10 @@ typedef char TCHAR;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#define stat64 stat
|
||||
#endif
|
||||
|
||||
// set up _S_ISDIR()
|
||||
#if !defined(S_ISDIR)
|
||||
# if defined( _S_IFDIR) && !defined( __S_IFDIR)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/// [EXPERIMENTAL] Disables animation data (and matrix transforms) for compatibility with some 3rd party apps.
|
||||
/// Animations are not read by all 3DS importers. Thus disabling them may allow some 3rd-party apps, such as Rhinoceros (tested with 4.0) to correctly import 3DS files.
|
||||
/// However, having proper hierarchy with matrix transforms will become impossible.
|
||||
///\warning This is still experimental, hence the compile flag. This should become a reader/writer option as soon as it works as intented (maybe "noMatrixTransforms" could become a read/write option?).
|
||||
///\warning This is still experimental, hence the compile flag. This should become a reader/writer option as soon as it works as intended (maybe "noMatrixTransforms" could become a read/write option?).
|
||||
#define DISABLE_3DS_ANIMATION 0 // Default = 0
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
@@ -123,7 +123,7 @@ osgDB::ReaderWriter::WriteResult ReaderWritterOpenCASCADE::writeNode(const osg::
|
||||
|
||||
/// \brief heals a opencascade shape
|
||||
/// \detail http://www.opencascade.org/org/forum/thread_12716/?forum=3
|
||||
/// Usually IGES files suffer from precision problems (when transfering from
|
||||
/// Usually IGES files suffer from precision problems (when transferring from
|
||||
/// one CAD system to another).It might be the case that faces are not sewed
|
||||
/// properly, or do not have the right precision, and so the tesselator does
|
||||
/// not treat them like "sewed". this needs to be done for sewing
|
||||
|
||||
@@ -91,7 +91,7 @@ class ReaderWritterOpenCASCADE: public osgDB::ReaderWriter
|
||||
|
||||
/// \brief heals a opencascade shape
|
||||
/// \detail http://www.opencascade.org/org/forum/thread_12716/?forum=3
|
||||
/// Usually IGES files suffer from precision problems (when transfering from
|
||||
/// Usually IGES files suffer from precision problems (when transferring from
|
||||
/// one CAD system to another).It might be the case that faces are not sewed
|
||||
/// properly, or do not have the right precision, and so the tesselator does
|
||||
/// not treat them like "sewed". this needs to be done for sewing
|
||||
|
||||
@@ -24,7 +24,7 @@ SET(TARGET_H
|
||||
IF(ZLIB_FOUND)
|
||||
SET(TARGET_LIBRARIES_VARS
|
||||
CURL_LIBRARY
|
||||
ZLIB_LIBRARY)
|
||||
ZLIB_LIBRARIES)
|
||||
ELSE()
|
||||
SET(TARGET_LIBRARIES_VARS
|
||||
CURL_LIBRARY)
|
||||
|
||||
@@ -39,7 +39,7 @@ void daeWriter::writeUpdateTransformElements(const osg::Vec3 &pos, const osg::Qu
|
||||
|
||||
// Make a three rotate place elements for the euler angles
|
||||
// TODO decompose quaternion into three euler angles
|
||||
double angle;
|
||||
osg::Quat::value_type angle;
|
||||
osg::Vec3 axis;
|
||||
q.getRotate( angle, axis );
|
||||
|
||||
@@ -154,7 +154,7 @@ void daeWriter::apply( osg::PositionAttitudeTransform &node )
|
||||
scale->getValue().append3( s.x(), s.y(), s.z() );
|
||||
}
|
||||
|
||||
double angle;
|
||||
osg::Quat::value_type angle;
|
||||
osg::Vec3 axis;
|
||||
q.getRotate( angle, axis );
|
||||
if ( angle != 0 )
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</p>
|
||||
<p><b>8. Limitation of Liability</b></p>
|
||||
|
||||
<p>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY WILL EITHER PARTY BE LIABLE TO THE OTHER PARTY OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR EXEMPLARY DAMAGES WITH RESPECT TO ANY INJURY, LOSS, OR DAMAGE, ARISING UNDER OR IN CONNECTION WITH THIS LETTER AGREEMENT, WHETHER FORESEEABLE OR UNFORESEEABLE, EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH INJURY, LOSS, OR DAMAGE. THE LIMITATIONS OF LIABILITY SET FORTH IN THIS SECTION SHALL APPLY TO THE FULLEST EXTENT PERMISSIBLE AT LAW OR ANY GOVERMENTAL REGULATIONS.
|
||||
<p>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY WILL EITHER PARTY BE LIABLE TO THE OTHER PARTY OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR EXEMPLARY DAMAGES WITH RESPECT TO ANY INJURY, LOSS, OR DAMAGE, ARISING UNDER OR IN CONNECTION WITH THIS LETTER AGREEMENT, WHETHER FORESEEABLE OR UNFORESEEABLE, EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH INJURY, LOSS, OR DAMAGE. THE LIMITATIONS OF LIABILITY SET FORTH IN THIS SECTION SHALL APPLY TO THE FULLEST EXTENT PERMISSIBLE AT LAW OR ANY GOVERNMENTAL REGULATIONS.
|
||||
</p>
|
||||
<p><b>9. Governing Law and Consent to Jurisdiction</b></p>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ IF (DCMTK_FOUND)
|
||||
|
||||
SET(TARGET_SRC ReaderWriterDICOM.cpp )
|
||||
|
||||
LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARY})
|
||||
LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS(-DUSE_DCMTK)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${OPENEXR_INCLUDE_DIR}/OpenEXR )
|
||||
|
||||
SET(TARGET_SRC ReaderWriterEXR.cpp )
|
||||
|
||||
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARY)
|
||||
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARIES)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Remove -Wshadow flag as it barfs on ffmoeg headers
|
||||
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
}
|
||||
|
||||
bool contains(unsigned int v1) const {
|
||||
return subvertices.count(v1);
|
||||
return subvertices.count(v1)!=0;
|
||||
}
|
||||
|
||||
void addTriangle(unsigned int v1, unsigned int v2, unsigned v3) {
|
||||
|
||||
@@ -62,8 +62,9 @@ namespace glesUtil {
|
||||
_geometry = target.getGeometry();
|
||||
_geometry->setPrimitiveSetList(morph.getPrimitiveSetList());
|
||||
|
||||
_hasTexCoord = _geometry->getTexCoordArrayList().size();
|
||||
if(!_hasTexCoord) {
|
||||
_hasTexCoord = !_geometry->getTexCoordArrayList().empty();
|
||||
if(_hasTexCoord)
|
||||
{
|
||||
_geometry->setTexCoordArrayList(morph.getTexCoordArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ SET(TARGET_SRC
|
||||
ReaderWriterGZ.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARY )
|
||||
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARIES )
|
||||
|
||||
|
||||
#### end var setup ###
|
||||
|
||||
@@ -269,7 +269,7 @@ SET(TARGET_H
|
||||
SET(TARGET_ADDED_LIBRARIES osgSim osgFX osgText osgTerrain osgVolume)
|
||||
|
||||
IF(ZLIB_FOUND)
|
||||
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARY)
|
||||
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
#### end var setup ###
|
||||
|
||||
@@ -70,12 +70,14 @@ namespace osgDBJPEG
|
||||
|
||||
static int jpegerror = ERR_NO_ERROR;
|
||||
|
||||
/* Some versions of jmorecfg.h define boolean, some don't...
|
||||
Those that do also define HAVE_BOOLEAN, so we can guard using that. */
|
||||
#ifndef HAVE_BOOLEAN
|
||||
typedef int boolean;
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#if JPEG_LIB_VERSION < 90
|
||||
/* Some versions of jmorecfg.h define boolean, some don't...
|
||||
Those that do also define HAVE_BOOLEAN, so we can guard using that. */
|
||||
#ifndef HAVE_BOOLEAN
|
||||
typedef int boolean;
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* CODE FOR READING/WRITING JPEG FROM STREAMS
|
||||
|
||||
@@ -493,7 +493,7 @@
|
||||
** a single double value, using NaN values to represent non-number
|
||||
** values. The trick only works on 32-bit machines (ints and pointers
|
||||
** are 32-bit values) with numbers represented as IEEE 754-2008 doubles
|
||||
** with conventional endianess (12345678 or 87654321), in CPUs that do
|
||||
** with conventional endianness (12345678 or 87654321), in CPUs that do
|
||||
** not produce signaling NaN values (all NaNs are quiet).
|
||||
*/
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ protected:
|
||||
bool fixBlackMaterials;
|
||||
bool noReverseFaces;
|
||||
// This is the order in which the materials will be assigned to texture maps, unless
|
||||
// otherwise overriden
|
||||
// otherwise overridden
|
||||
typedef std::vector< std::pair<int,obj::Material::Map::TextureMapType> > TextureAllocationMap;
|
||||
TextureAllocationMap textureUnitAllocation;
|
||||
/// Coordinates precision.
|
||||
|
||||
@@ -32,7 +32,7 @@ Purpose:
|
||||
std::streampos actually points past 32 bit addressable range (2 GiB).
|
||||
|
||||
Even if std::streamoff is 32 bit and incapable of representing 64 bit file
|
||||
positions, original std::streampos may be prefectly able to handle them.
|
||||
positions, original std::streampos may be perfectly able to handle them.
|
||||
|
||||
But, when such situation occurs more elaborate conversion methods from/to
|
||||
std::streampos are needed. Functions below employ such methods.
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include <osg/Geode>
|
||||
#include <osg/io_utils>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
#include <osg/TexEnv>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osg/Texture2D>
|
||||
|
||||
using namespace std;
|
||||
using namespace ply;
|
||||
@@ -35,6 +39,7 @@ VertexData::VertexData()
|
||||
_diffuse = NULL;
|
||||
_ambient = NULL;
|
||||
_specular = NULL;
|
||||
_texcoord = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +71,8 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
unsigned char specular_blue;
|
||||
float specular_coeff;
|
||||
float specular_power;
|
||||
float texture_u;
|
||||
float texture_v;
|
||||
} vertex;
|
||||
|
||||
PlyProperty vertexProps[] =
|
||||
@@ -74,8 +81,8 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
{ "y", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, y ), 0, 0, 0, 0 },
|
||||
{ "z", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, z ), 0, 0, 0, 0 },
|
||||
{ "nx", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, nx ), 0, 0, 0, 0 },
|
||||
{ "ny", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, ny ), 0, 0, 0, 0 },
|
||||
{ "nz", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, nz ), 0, 0, 0, 0 },
|
||||
{ "ny", PLY_FLOAT, PLY_FLOAT, offsetof(_Vertex, ny), 0, 0, 0, 0 },
|
||||
{ "nz", PLY_FLOAT, PLY_FLOAT, offsetof(_Vertex, nz), 0, 0, 0, 0 },
|
||||
{ "red", PLY_UCHAR, PLY_UCHAR, offsetof( _Vertex, red ), 0, 0, 0, 0 },
|
||||
{ "green", PLY_UCHAR, PLY_UCHAR, offsetof( _Vertex, green ), 0, 0, 0, 0 },
|
||||
{ "blue", PLY_UCHAR, PLY_UCHAR, offsetof( _Vertex, blue ), 0, 0, 0, 0 },
|
||||
@@ -91,6 +98,8 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
{ "specular_blue", PLY_UCHAR, PLY_UCHAR, offsetof( _Vertex, specular_blue ), 0, 0, 0, 0 },
|
||||
{ "specular_coeff", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, specular_coeff ), 0, 0, 0, 0 },
|
||||
{ "specular_power", PLY_FLOAT, PLY_FLOAT, offsetof( _Vertex, specular_power ), 0, 0, 0, 0 },
|
||||
{ "texture_u", PLY_FLOAT, PLY_FLOAT, offsetof(_Vertex, texture_u), 0, 0, 0, 0 },
|
||||
{ "texture_v", PLY_FLOAT, PLY_FLOAT, offsetof(_Vertex, texture_v), 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
// use all 6 properties when reading colors, only the first 3 otherwise
|
||||
@@ -120,6 +129,10 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
for( int i = 16; i < 21; ++i )
|
||||
ply_get_property( file, "vertex", &vertexProps[i] );
|
||||
|
||||
if (fields & TEXCOORD)
|
||||
for (int i = 21; i < 23; ++i)
|
||||
ply_get_property(file, "vertex", &vertexProps[i]);
|
||||
|
||||
// check whether array is valid otherwise allocate the space
|
||||
if(!_vertices.valid())
|
||||
_vertices = new osg::Vec3Array;
|
||||
@@ -154,6 +167,11 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
if(!_specular.valid())
|
||||
_specular = new osg::Vec4Array;
|
||||
}
|
||||
if (fields & TEXCOORD)
|
||||
{
|
||||
if (!_texcoord.valid())
|
||||
_texcoord = new osg::Vec2Array;
|
||||
}
|
||||
|
||||
// read in the vertices
|
||||
for( int i = 0; i < nVertices; ++i )
|
||||
@@ -186,6 +204,8 @@ void VertexData::readVertices( PlyFile* file, const int nVertices,
|
||||
_specular->push_back( osg::Vec4( (unsigned int) vertex.specular_red / 255.0,
|
||||
(unsigned int) vertex.specular_green / 255.0 ,
|
||||
(unsigned int) vertex.specular_blue / 255.0, 1.0 ) );
|
||||
if (fields & TEXCOORD)
|
||||
_texcoord->push_back(osg::Vec2(vertex.texture_u,vertex.texture_v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,13 +311,47 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
MESHINFO << filename << ": " << nPlyElems << " elements, file type = "
|
||||
<< fileType << ", version = " << version << endl;
|
||||
#endif
|
||||
|
||||
char *textureFile = NULL;
|
||||
for( int i = 0; i < nComments; i++ )
|
||||
{
|
||||
if( equal_strings( comments[i], "modified by flipply" ) )
|
||||
{
|
||||
_invertFaces = true;
|
||||
}
|
||||
if (strncmp(comments[i], "TextureFile",11)==0)
|
||||
{
|
||||
textureFile = comments[i]+12;
|
||||
char * path = new char[strlen(const_cast<char*>(filename)) + 1 + strlen(comments[i])];
|
||||
if (textureFile[0] == '\\' || textureFile[0] == '/' || textureFile[1] == ':')
|
||||
{
|
||||
// texture filename is absolute
|
||||
strcpy(path, textureFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// texture filename is relative
|
||||
// add directory of ply file
|
||||
strcpy(path, const_cast<char*>(filename));
|
||||
char *pp = path + strlen(path);
|
||||
while (pp >= path)
|
||||
{
|
||||
if (*pp == '\\' || *pp == '/')
|
||||
{
|
||||
pp++;
|
||||
*pp = '\0';
|
||||
break;
|
||||
}
|
||||
pp--;
|
||||
}
|
||||
if (pp == path - 1)
|
||||
{
|
||||
pp++;
|
||||
*pp = '\0';
|
||||
}
|
||||
strcat(path, textureFile);
|
||||
}
|
||||
textureFile = path;
|
||||
}
|
||||
|
||||
}
|
||||
for( int i = 0; i < nPlyElems; ++i )
|
||||
@@ -330,10 +384,10 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
// if the string is vertex means vertex data is started
|
||||
if( equal_strings( elemNames[i], "vertex" ) )
|
||||
{
|
||||
int fields = NONE;
|
||||
int fields = NONE;
|
||||
// determine if the file stores vertex colors
|
||||
for( int j = 0; j < nProps; ++j )
|
||||
{
|
||||
{
|
||||
// if the string have the red means color info is there
|
||||
if( equal_strings( props[j]->name, "x" ) )
|
||||
fields |= XYZ;
|
||||
@@ -347,15 +401,19 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
fields |= AMBIENT;
|
||||
if( equal_strings( props[j]->name, "diffuse_red" ) )
|
||||
fields |= DIFFUSE;
|
||||
if( equal_strings( props[j]->name, "specular_red" ) )
|
||||
if (equal_strings(props[j]->name, "specular_red"))
|
||||
fields |= SPECULAR;
|
||||
}
|
||||
if (equal_strings(props[j]->name, "texture_u"))
|
||||
fields |= TEXCOORD;
|
||||
if (equal_strings(props[j]->name, "texture_v"))
|
||||
fields |= TEXCOORD;
|
||||
}
|
||||
|
||||
if( ignoreColors )
|
||||
{
|
||||
fields &= ~(XYZ | NORMALS);
|
||||
MESHINFO << "Colors in PLY file ignored per request." << endl;
|
||||
}
|
||||
{
|
||||
fields &= ~(XYZ | NORMALS);
|
||||
MESHINFO << "Colors in PLY file ignored per request." << endl;
|
||||
}
|
||||
|
||||
try {
|
||||
// Read vertices and store in a std::vector array
|
||||
@@ -363,7 +421,7 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
// Check whether all vertices are loaded or not
|
||||
MESHASSERT( _vertices->size() == static_cast< size_t >( nElems ) );
|
||||
|
||||
// Check if all the optional elements were read or not
|
||||
// Check if all the optional elements were read or not
|
||||
if( fields & NORMALS )
|
||||
{
|
||||
MESHASSERT( _normals->size() == static_cast< size_t >( nElems ) );
|
||||
@@ -380,9 +438,13 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
{
|
||||
MESHASSERT( _diffuse->size() == static_cast< size_t >( nElems ) );
|
||||
}
|
||||
if( fields & SPECULAR )
|
||||
if (fields & SPECULAR)
|
||||
{
|
||||
MESHASSERT( _specular->size() == static_cast< size_t >( nElems ) );
|
||||
MESHASSERT(_specular->size() == static_cast< size_t >(nElems));
|
||||
}
|
||||
if (fields & TEXCOORD)
|
||||
{
|
||||
MESHASSERT(_texcoord->size() == static_cast< size_t >(nElems));
|
||||
}
|
||||
|
||||
result = true;
|
||||
@@ -462,9 +524,9 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, _vertices->size()));
|
||||
|
||||
|
||||
// Apply the colours to the model; at the moment this is a
|
||||
// kludge because we only use one kind and apply them all the
|
||||
// same way. Also, the priority order is completely arbitrary
|
||||
// Apply the colours to the model; at the moment this is a
|
||||
// kludge because we only use one kind and apply them all the
|
||||
// same way. Also, the priority order is completely arbitrary
|
||||
|
||||
if(_colors.valid())
|
||||
{
|
||||
@@ -478,10 +540,14 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
{
|
||||
geom->setColorArray(_diffuse.get(), osg::Array::BIND_PER_VERTEX );
|
||||
}
|
||||
else if(_specular.valid())
|
||||
else if(_specular.valid())
|
||||
{
|
||||
geom->setColorArray(_specular.get(), osg::Array::BIND_PER_VERTEX );
|
||||
}
|
||||
else if (_texcoord.valid())
|
||||
{
|
||||
geom->setTexCoordArray(0, _texcoord);
|
||||
}
|
||||
|
||||
// If the model has normals, add them to the geometry
|
||||
if(_normals.valid())
|
||||
@@ -497,11 +563,26 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor
|
||||
// set flage true to activate the vertex buffer object of drawable
|
||||
geom->setUseVertexBufferObjects(true);
|
||||
|
||||
osg::Image *image = NULL;
|
||||
if (textureFile && (image = osgDB::readImageFile(textureFile)) != NULL)
|
||||
{
|
||||
osg::Texture2D *texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
texture->setResizeNonPowerOfTwoHint(false);
|
||||
|
||||
osg::TexEnv *texenv = new osg::TexEnv;
|
||||
texenv->setMode(osg::TexEnv::REPLACE);
|
||||
|
||||
osg::StateSet *stateset = geom->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
||||
stateset->setTextureAttribute(0, texenv);
|
||||
delete[] textureFile;
|
||||
}
|
||||
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->addDrawable(geom);
|
||||
return geode;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace ply
|
||||
AMBIENT = 8,
|
||||
DIFFUSE = 16,
|
||||
SPECULAR = 32,
|
||||
RGBA = 64
|
||||
RGBA = 64,
|
||||
TEXCOORD = 128
|
||||
};
|
||||
|
||||
// Function which reads all the vertices and colors if color info is
|
||||
@@ -75,6 +76,7 @@ namespace ply
|
||||
osg::ref_ptr<osg::Vec4Array> _ambient;
|
||||
osg::ref_ptr<osg::Vec4Array> _diffuse;
|
||||
osg::ref_ptr<osg::Vec4Array> _specular;
|
||||
osg::ref_ptr<osg::Vec2Array> _texcoord;
|
||||
|
||||
// Normals in osg format
|
||||
osg::ref_ptr<osg::Vec3Array> _normals;
|
||||
|
||||
@@ -5,7 +5,7 @@ IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
|
||||
ENDIF()
|
||||
|
||||
SET(TARGET_SRC ReaderWriterPNG.cpp )
|
||||
SET(TARGET_LIBRARIES_VARS PNG_LIBRARY ZLIB_LIBRARY )
|
||||
SET(TARGET_LIBRARIES_VARS PNG_LIBRARY ZLIB_LIBRARIES )
|
||||
|
||||
|
||||
#### end var setup ###
|
||||
|
||||
@@ -174,6 +174,22 @@ static int getInt16(unsigned char *ptr)
|
||||
return res | (tmp<<8);
|
||||
}
|
||||
|
||||
static int getInt24(unsigned char *ptr)
|
||||
{
|
||||
int temp1 = ptr[0];
|
||||
int temp2 = ptr[1];
|
||||
int temp3 = ptr[2];
|
||||
return temp1 | (temp2 << 8) | (temp3 << 16);
|
||||
}
|
||||
|
||||
static int getInt32(unsigned char *ptr)
|
||||
{
|
||||
int temp1 = ptr[0];
|
||||
int temp2 = ptr[1];
|
||||
int temp3 = ptr[2];
|
||||
int temp4 = ptr[3];
|
||||
return temp1 | (temp2 << 8) | (temp3 << 16) | (temp4 << 24);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* decode a new rle packet */
|
||||
@@ -257,6 +273,7 @@ int *numComponents_ret)
|
||||
int flags;
|
||||
int format;
|
||||
unsigned char *colormap;
|
||||
int colormapLen;
|
||||
int indexsize;
|
||||
int rleIsCompressed;
|
||||
int rleRemaining;
|
||||
@@ -283,10 +300,10 @@ int *numComponents_ret)
|
||||
flags = header[17];
|
||||
|
||||
/* check for reasonable values in case this is not a tga file */
|
||||
if ((type != 2 && type != 10) ||
|
||||
if ((type != 1 && type != 2 && type != 10) ||
|
||||
(width < 0 || width > 4096) ||
|
||||
(height < 0 || height > 4096) ||
|
||||
(depth < 2 || depth > 4))
|
||||
(depth < 1 || depth > 4))
|
||||
{
|
||||
tgaerror = ERR_UNSUPPORTED;
|
||||
return NULL;
|
||||
@@ -298,18 +315,28 @@ int *numComponents_ret)
|
||||
colormap = NULL;
|
||||
if (header[1] == 1) /* there is a colormap */
|
||||
{
|
||||
int len = getInt16(&header[5]);
|
||||
colormapLen = getInt16(&header[5]);
|
||||
indexsize = header[7]>>3;
|
||||
colormap = new unsigned char [len*indexsize];
|
||||
fin.read((char*)colormap,len*indexsize);
|
||||
}
|
||||
colormap = new unsigned char [colormapLen*indexsize];
|
||||
fin.read((char*)colormap,colormapLen*indexsize);
|
||||
|
||||
if (depth == 2) /* 16 bits */
|
||||
{
|
||||
if (flags & 1) format = 4;
|
||||
else format = 3;
|
||||
if (indexsize == 2) /* 16 bits */
|
||||
{
|
||||
if (flags & 1) format = 4;
|
||||
else format = 3;
|
||||
}
|
||||
else
|
||||
format = indexsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth == 2) /* 16 bits */
|
||||
{
|
||||
if (flags & 1) format = 4;
|
||||
else format = 3;
|
||||
}
|
||||
else format = depth;
|
||||
}
|
||||
else format = depth;
|
||||
|
||||
/* SoDebugError::postInfo("simage_tga_load", "TARGA file: %d %d %d %d %d\n", */
|
||||
/* type, width, height, depth, format); */
|
||||
@@ -331,6 +358,57 @@ int *numComponents_ret)
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 1: /* colormap, uncompressed */
|
||||
{
|
||||
unsigned char * formattedMap = new unsigned char[colormapLen * format];
|
||||
for (int i = 0; i < colormapLen; i++)
|
||||
{
|
||||
convert_data(colormap, formattedMap, i, indexsize, format);
|
||||
}
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
fin.read((char*)linebuf, width*depth);
|
||||
if (fin.gcount() != (std::streamsize) (width*depth))
|
||||
{
|
||||
tgaerror = ERR_READ;
|
||||
break;
|
||||
}
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
int index;
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
index = linebuf[x];
|
||||
break;
|
||||
case 2:
|
||||
index = getInt16(linebuf + x * 2);
|
||||
break;
|
||||
case 3:
|
||||
index = getInt24(linebuf + x * 3);
|
||||
break;
|
||||
case 4:
|
||||
index = getInt32(linebuf + x * 4);
|
||||
break;
|
||||
default:
|
||||
tgaerror = ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
int adjustedX = bLeftToRight ? x : (width - 1) - x;
|
||||
for (int i = 0; i < format; i++)
|
||||
(dest + adjustedX * format)[i] = (formattedMap + index * format)[i];
|
||||
}
|
||||
dest += lineoffset;
|
||||
}
|
||||
|
||||
if (formattedMap)
|
||||
delete[] formattedMap;
|
||||
}
|
||||
break;
|
||||
case 2: /* RGB, uncompressed */
|
||||
{
|
||||
int x, y;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -161,7 +161,7 @@ osg::Group *TXPParser::parseScene(
|
||||
_root->accept(lv);
|
||||
|
||||
//modified by Brad Anderegg May-27-08
|
||||
//running the optimizer on the terrain fixes some major preformance issues, unfortunately the texture atlas builder seems to get messed up
|
||||
//running the optimizer on the terrain fixes some major performance issues, unfortunately the texture atlas builder seems to get messed up
|
||||
//on some of the textures (usually around buildings) and the tri stripper seems to occasionally crash and also mess up the indices on certain buildings.
|
||||
osgUtil::Optimizer opt;
|
||||
opt.optimize(_root.get(), (osgUtil::Optimizer::ALL_OPTIMIZATIONS ^ osgUtil::Optimizer::TEXTURE_ATLAS_BUILDER) ^ osgUtil::Optimizer::TRISTRIP_GEOMETRY);
|
||||
@@ -1433,7 +1433,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf)
|
||||
if (geometry.valid() && top)
|
||||
{
|
||||
|
||||
//modifed by Brad Anderegg on May-27-08
|
||||
//modified by Brad Anderegg on May-27-08
|
||||
//using display lists actually increases our framerate by
|
||||
//a fair amount, on certain laptops it increased by as much as 1000%
|
||||
geometry->setUseDisplayList(true);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* OpenSceneGraph loader for Terrapage format database
|
||||
* by Boris Bralo 2002
|
||||
*
|
||||
* based on/modifed sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
* based on/modified sgl (Scene Graph Library) loader by Bryan Walsh
|
||||
*
|
||||
* This loader is based on/modified from Terrain Experts Performer Loader,
|
||||
* and was ported to SGL by Bryan Walsh / bryanw at earthlink dot net
|
||||
|
||||
@@ -3112,7 +3112,7 @@ public:
|
||||
|
||||
// Set the text alignment. See GetAlignmentType() for more information.
|
||||
void SetAlignment(AlignmentType);
|
||||
/* Return the alignement type. This controls the alignement of the text
|
||||
/* Return the alignment type. This controls the alignment of the text
|
||||
with respect to the label geometry.
|
||||
*/
|
||||
AlignmentType GetAlignment(void) const;
|
||||
|
||||
@@ -562,7 +562,7 @@ TX_EXDECL class TX_CLDECL trpgCheckable {
|
||||
public:
|
||||
trpgCheckable(void);
|
||||
virtual ~trpgCheckable(void);
|
||||
// Returns the state of the valid flag, or can be overriden by a subclass to do a more complex check.
|
||||
// Returns the state of the valid flag, or can be overridden by a subclass to do a more complex check.
|
||||
bool isValid(void) const;
|
||||
|
||||
virtual TeAttrHdl GetHandle() const {
|
||||
@@ -606,7 +606,7 @@ public:
|
||||
/* The Write method is a virtual that must be filled in by the subclass.
|
||||
It takes a trpgWriteBuffer and should return true on success. */
|
||||
virtual bool Write(trpgWriteBuffer &) = 0;
|
||||
/* The Read method should be overriden by a subclass. It should read
|
||||
/* The Read method should be overridden by a subclass. It should read
|
||||
the contents of the given trpgReadBuffer up to the current limit
|
||||
into itself. It must return true on success. */
|
||||
virtual bool Read(trpgReadBuffer &) { return false;};
|
||||
|
||||
@@ -338,7 +338,7 @@ bool trpgr_Archive::ReadHeader(bool readAllBlocks)
|
||||
// Read Tile
|
||||
// Read a tile into a read buffer
|
||||
// For version 2.1 only tile with lod=0 are stored in the tile table, so an
|
||||
// error will be returned if you try to use the table with a differrent lod.
|
||||
// error will be returned if you try to use the table with a different lod.
|
||||
bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf)
|
||||
{
|
||||
if (!isValid())
|
||||
|
||||
@@ -4,7 +4,7 @@ INCLUDE_DIRECTORIES(${LIBVNCSERVER_INCLUDE_DIR})
|
||||
|
||||
SET(TARGET_EXTERNAL_LIBRARIES
|
||||
${LIBVNCCLIENT_LIBRARY}
|
||||
${ZLIB_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${JPEG_LIBRARY} )
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget )
|
||||
|
||||
@@ -199,7 +199,7 @@ static rfbBool rfbInitConnection(rfbClient* client)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LibVncImage::passwordCheck(rfbClient* client,const char* encryptedPassWord,int len)
|
||||
void LibVncImage::passwordCheck(rfbClient* /*client*/,const char* /*encryptedPassWord*/,int /*len*/)
|
||||
{
|
||||
OSG_NOTICE<<"LibVncImage::passwordCheck"<<std::endl;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ rfbBool LibVncImage::resizeImage(rfbClient* client)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LibVncImage::updateImage(rfbClient* client,int x,int y,int w,int h)
|
||||
void LibVncImage::updateImage(rfbClient* client, int /*x*/, int /*y*/, int /*w*/, int /*h*/)
|
||||
{
|
||||
LibVncImage* image = (LibVncImage*)(rfbClientGetClientData(client, 0));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ IF (WIN32)
|
||||
OPENVRML_LIBRARY
|
||||
JPEG_LIBRARY
|
||||
PNG_LIBRARY
|
||||
ZLIB_LIBRARY)
|
||||
ZLIB_LIBRARIES)
|
||||
SET(TARGET_EXTERNAL_LIBRARIES
|
||||
Ws2_32.lib)
|
||||
ELSE()
|
||||
|
||||
@@ -294,7 +294,7 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator()
|
||||
|
||||
#if 1
|
||||
// Original LiSPSM Paper suggests that algorithm should work for all light types:
|
||||
// infinte directional, omnidirectional and spot types may be treated as directional
|
||||
// infinite directional, omnidirectional and spot types may be treated as directional
|
||||
// as all computations are performed in post projection light space.
|
||||
// Frankly, I have my doubts if their error analysis and methodology still works
|
||||
// in non directional lights post projective space. But since I can't prove it doesn't,
|
||||
|
||||
@@ -138,7 +138,7 @@ void MinimalShadowMap::ViewData::aimShadowCastingCamera
|
||||
|
||||
if( up.length2() <= 0 )
|
||||
{
|
||||
// This is extra step (not really needed but helpful in debuging)
|
||||
// This is extra step (not really needed but helpful in debugging)
|
||||
// Compute such lightUp vector that shadow cam is intuitively aligned with eye
|
||||
// We compute this vector on -ZY view plane, perpendicular to light direction
|
||||
// Matrix m = ViewToWorld
|
||||
@@ -234,7 +234,7 @@ void MinimalShadowMap::ViewData::frameShadowCastingCamera
|
||||
if( bb.valid() )
|
||||
trimProjection( cameraShadow->getProjectionMatrix(), bb, 1|2|4|8|16|32 );
|
||||
|
||||
///// Debuging stuff //////////////////////////////////////////////////////////
|
||||
///// Debugging stuff //////////////////////////////////////////////////////////
|
||||
setDebugPolytope( "scene", _sceneReceivingShadowPolytope, osg::Vec4(0,1,0,1) );
|
||||
|
||||
|
||||
|
||||
@@ -21,12 +21,14 @@ namespace osgText
|
||||
Text3D::Text3D():
|
||||
_renderMode(PER_GLYPH)
|
||||
{
|
||||
_glyphNormalized = true;
|
||||
}
|
||||
|
||||
Text3D::Text3D(const Text3D & text3D, const osg::CopyOp & copyop):
|
||||
osgText::TextBase(text3D, copyop),
|
||||
_renderMode(text3D._renderMode)
|
||||
{
|
||||
_glyphNormalized = text3D._glyphNormalized;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
@@ -270,7 +272,7 @@ void Text3D::computeGlyphRepresentation()
|
||||
osg::Vec2 endOfLine_coords(cursor);
|
||||
String::iterator endOfLine_itr = computeLastCharacterOnLine(endOfLine_coords, itr,_text.end());
|
||||
|
||||
// ** position the cursor function to the Layout and the alignement
|
||||
// ** position the cursor function to the Layout and the alignment
|
||||
TextBase::positionCursor(endOfLine_coords, cursor, (unsigned int) (endOfLine_itr - startOfLine_itr));
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ TextBase::TextBase():
|
||||
_textBBMargin(0.0f),
|
||||
_textBBColor(0.0, 0.0, 0.0, 0.5),
|
||||
_kerningType(KERNING_DEFAULT),
|
||||
_lineCount(0)
|
||||
_lineCount(0),
|
||||
_glyphNormalized(false)
|
||||
{
|
||||
setStateSet(Font::getDefaultFont()->getStateSet());
|
||||
setUseDisplayList(false);
|
||||
@@ -78,7 +79,8 @@ TextBase::TextBase(const TextBase& textBase,const osg::CopyOp& copyop):
|
||||
_textBBMargin(textBase._textBBMargin),
|
||||
_textBBColor(textBase._textBBColor),
|
||||
_kerningType(textBase._kerningType),
|
||||
_lineCount(textBase._lineCount)
|
||||
_lineCount(textBase._lineCount),
|
||||
_glyphNormalized(textBase._glyphNormalized)
|
||||
{
|
||||
initArraysAndBuffers();
|
||||
}
|
||||
@@ -537,6 +539,12 @@ bool TextBase::computeMatrix(osg::Matrix& matrix, osg::State* state) const
|
||||
if (pixelSizeHori == 0.0f)
|
||||
pixelSizeHori= 1.0f;
|
||||
|
||||
if (_glyphNormalized)
|
||||
{
|
||||
osg::Vec3 scaleVec(_characterHeight/getCharacterAspectRatio(), _characterHeight, _characterHeight);
|
||||
matrix.postMultScale(scaleVec);
|
||||
}
|
||||
|
||||
if (_characterSizeMode==SCREEN_COORDS)
|
||||
{
|
||||
float scale_font_vert=_characterHeight/pixelSizeVert;
|
||||
@@ -544,12 +552,12 @@ bool TextBase::computeMatrix(osg::Matrix& matrix, osg::State* state) const
|
||||
|
||||
if (P10<0)
|
||||
scale_font_vert=-scale_font_vert;
|
||||
matrix.postMultScale(osg::Vec3f(scale_font_hori, scale_font_vert,1.0f));
|
||||
matrix.postMultScale(osg::Vec3f(scale_font_hori, scale_font_vert, scale_font_hori));
|
||||
}
|
||||
else if (pixelSizeVert>getFontHeight())
|
||||
{
|
||||
float scale_font = getFontHeight()/pixelSizeVert;
|
||||
matrix.postMultScale(osg::Vec3f(scale_font, scale_font,1.0f));
|
||||
matrix.postMultScale(osg::Vec3f(scale_font, scale_font, scale_font));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -560,17 +568,29 @@ bool TextBase::computeMatrix(osg::Matrix& matrix, osg::State* state) const
|
||||
}
|
||||
|
||||
matrix.postMultTranslate(_position);
|
||||
|
||||
}
|
||||
else if (!_rotation.zeroRotation())
|
||||
{
|
||||
matrix.makeRotate(_rotation);
|
||||
matrix.preMultTranslate(-_offset);
|
||||
matrix.makeTranslate(-_offset);
|
||||
if (_glyphNormalized)
|
||||
{
|
||||
osg::Vec3 scaleVec(_characterHeight/getCharacterAspectRatio(), _characterHeight, _characterHeight);
|
||||
matrix.postMultScale(scaleVec);
|
||||
}
|
||||
matrix.postMultRotate(_rotation);
|
||||
matrix.postMultTranslate(_position);
|
||||
// OSG_NOTICE<<"New Need to rotate "<<matrix<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix.makeTranslate(_position-_offset);
|
||||
matrix.makeTranslate(-_offset);
|
||||
if (_glyphNormalized)
|
||||
{
|
||||
osg::Vec3 scaleVec(_characterHeight/getCharacterAspectRatio(), _characterHeight, _characterHeight);
|
||||
matrix.postMultScale(scaleVec);
|
||||
}
|
||||
matrix.postMultTranslate(_position);
|
||||
}
|
||||
|
||||
if (_matrix!=matrix)
|
||||
|
||||
@@ -332,7 +332,7 @@ double IncrementalCompileOperation::CompileList::estimatedTimeForCompile(Compile
|
||||
{
|
||||
double estimateTime = 0.0;
|
||||
for(CompileOps::const_iterator itr = _compileOps.begin();
|
||||
itr != _compileOps.begin();
|
||||
itr != _compileOps.end();
|
||||
++itr)
|
||||
{
|
||||
estimateTime += (*itr)->estimatedTimeForCompile(compileInfo);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user