Compare commits

..

49 Commits

Author SHA1 Message Date
Robert Osfield
ace1188557 Release OpenSceneGraph-2.8.2 2009-07-28 06:13:31 +00:00
Robert Osfield
817780e67c Updated ChangeLog 2009-07-28 06:13:20 +00:00
Robert Osfield
7ed9ef7db0 Updated dates for 2.8.2 stable release 2009-07-28 06:02:27 +00:00
Robert Osfield
12d20ee257 From Jean-Sebastien Guay, updated CTestConfig to point to new cdash.openscenegraph.org site 2009-07-24 12:12:33 +00:00
Robert Osfield
2bed6a2dca From J.P. Delport, "attached a modified jpeg plugin that allows writing of grayscale images." 2009-07-17 07:50:06 +00:00
Robert Osfield
315e749cce Update ChangeLog and NEWS for 2.8.2-rc4 2009-07-16 13:30:00 +00:00
Robert Osfield
0b5d743411 Updated release candidate number to 4 2009-07-16 13:18:12 +00:00
Robert Osfield
0029d8fc46 From Fabien Lavignotte, "When exporting some models to OpenFlight, i found a crash if the texture
unit does not contain a TexEnv object.
Here's the small fix, just a test on the pointer."

Merged from svn trunk using:

svn merge -r 10490:10491 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight
2009-07-16 12:11:18 +00:00
Robert Osfield
a5d6c1a6a3 From Stephane Lamoliatte, "The vertical anchor is inverted in the osgWidget::Window::update function.
Here is a small patch to fix that."
2009-07-16 12:06:42 +00:00
Robert Osfield
65f85fee6d From Cedric Pinson, crash fix for osganimationtimeline that was caused by not checking if nathan.osg test file had be loaded or not. 2009-07-16 11:52:18 +00:00
Robert Osfield
df14b9980a From Jason Daly, "These are some fixes to the mdl and bsp plugins to handle transparency and lighting better, plus a few other tweaks." 2009-07-16 11:42:08 +00:00
Robert Osfield
7ba85b16db From Colin MacDonald, "The Optimizer Merge Geometry visitor is always merging geometries,
even if they have had DataVariance DYNAMIC explicitly specified.  Then
when an application attempts to dynamically update the geometry in the
frame loop the primitive sets and data arrays are no longer as
expected, leading to display and/or memory corruption.

Attached is a simple fix."

Note from Robert Osfield, tweaked Colin's changes so that it uses != DYNAMIC rather == STATIC in the additional test.

Merged from svn/trunk using:

   svn merge -r 10479:10480 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
2009-07-16 11:09:16 +00:00
Robert Osfield
bda1350be4 Tweaked news 2009-07-14 16:02:55 +00:00
Robert Osfield
31f2e7902f Updated contributors, authors file, news and changelog for 2.8.2-rc3 2009-07-14 15:49:40 +00:00
Robert Osfield
e89336a306 From Cory Riddell based on suggestion from Robert Osfield, "I've been running with your suggested changes for a few days now and it
has been working perfectly. I'm still not entirely clear why adding a
slave/subgraph causes the problem."
2009-07-13 16:45:06 +00:00
Robert Osfield
9a8abe7fee From David Fries, "Here is a fix for a deadlock seen under Windows using OpenThreads
Barrier operations.  The error is with atomic operations in the
win32 condition implementation.  The attached sample program will
reliably trigger with as few as three threads and a dual core system,
though sometimes it will take 65,000 iterations.

2.8.1 was the base for these changes

Win32ConditionPrivateData.h
Win32ConditionPrivateData::wait does two operations to decrement
waiters_ then read, when InterlockedDecrement decrements and returns
the value in one operation.  The two operations allows another thread
to also decrement with both getting 0 for an answer.

Win32ConditionPrivateData::broadcast is using waiters_ directly
instead of using the w value read earlier, if it was safe to use
waiters_ directly there would be no need for InterlockedGet or w.

overview of deadlock in barrier with three threads
one thread in broadcast, 2 threads in wait,
release semaphore 2, waits on waiters_done_
both threads wake, decrement waiters_, get 0 for w,
       <logic error here>
one calls set waiters_done_,
broadcast thread comes out of waiters_done_,
other thread calls waiters_done_, (which leaves waiters_done_ in the
signaled state)
       <sets the trap>
broadcast thread returns releases mutex, other threads get
mutex and also return,
next barrier, first two threads enter wait, one goes to broadcast, release
semaphore 2, skips waiters_done_ as it had been released last time
returns, processes, enters the barrier for the next barrier operation
and waits,
three threads are now in wait, two have the previous barrier phase,
one the current phase, there's one count left in the semaphore which a
thread gets, returns, enters the barrier as a waiter, sleeps, and the
deadlock is completed"

Merged from svn/trunk using:

svn merge -r 10456:10457 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/OpenThreads/win32
2009-07-13 16:07:47 +00:00
Robert Osfield
01b27a9fb2 From Paul Fotheringham, fixed linux build error when compiling dicom plugin against ITK by adding define VCL_CAN_STATIC_CONST_INIT_FLOAT to be zero.
From Robert Osfield, general clean up of CMakeLists.txt under ITK side
2009-07-03 19:08:55 +00:00
Robert Osfield
21f735d653 From Bryan Thrall, "The OpenFlight plugin doesn't handle unrecognized options or extra
whitespace in all cases, causing it to crash."
2009-07-01 15:39:48 +00:00
Robert Osfield
4dfa7485c1 Updated NEWS for and READE for 2.9.2-rc2. 2009-06-29 09:50:45 +00:00
Robert Osfield
7bbc1c419b Updated release candidate to 2 2009-06-29 09:47:46 +00:00
Robert Osfield
ab029febbd Made --pssm and --sv options use SingleThreaded viewer to workaround threading issues with ParallelSplitShadowMap and ShadowVolume techniques. 2009-06-29 09:46:40 +00:00
Robert Osfield
d5d19ac1a4 Updated to NEWS to map to wiki NEWS item 2009-06-25 16:08:25 +00:00
Robert Osfield
44da3958c3 From Mathias Froehlich, changes from atof to use osg::asciiToFloat() to avoid locale issues with atof 2009-06-25 14:06:29 +00:00
Robert Osfield
26e3f00882 From Mathias Froehlich, "Fix possible problem with aliasing rules... and fix a gcc warning :)
Use a union to determine if we are on a little endian or big endian machine."

Merged from svn/trunk using :

svn merge -r 10409:10410 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/include/osg/
2009-06-25 13:27:37 +00:00
Robert Osfield
fb6e1d4d9f Fixed swap size error.
Merged from svn/trunk using:

  svn merge -r 10386:10387 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgPlugins/txp/
2009-06-22 16:04:46 +00:00
Robert Osfield
e4fa4f9119 Updated NEWS, AUTHORS and ChangeLog for 2.8.2-rc1 release 2009-06-22 09:32:42 +00:00
Robert Osfield
a9c1dd1a4a Merged from svn/trunk fix to initGLNames() which addressed thread safety issue 2009-06-22 07:42:57 +00:00
Robert Osfield
102e5c2439 From Farshid Lashkari, "I found a bug in the osgText library in version 1.2 that I believe still exists in the latest version.
I found that changing the alignment of a text object does not work properly if the text contains newline characters. I've attached a simple test case that shows the problem. If I set the text AFTER setting the alignment, everything works fine. But if I set the text BEFORE setting the alignment then the text is displayed incorrectly.

The fix is very simple. Instead of calling computePositions() in TextBase::setAlignment(), it calls computeGlyphRepresentation(). I've attached the modified TextBase.cpp."

Merged from svn/trunk using:

  svn merge -r 10375:10376 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgText/TextBase.cpp
2009-06-20 11:38:22 +00:00
Robert Osfield
264746a5c2 Added clears of input vectors in various get*() methods 2009-06-19 11:02:15 +00:00
Robert Osfield
dfa3c9a2c9 Updated ChangeLog 2009-06-19 10:44:47 +00:00
Robert Osfield
b795e65a39 From Rene Molenaar, "The bug is as described above:
"The dragger's corner tabs are no longer in the corners."

this fix places the cornertabs back in the corners.
(the manipulator does not make sense otherwise)."
2009-06-18 08:19:37 +00:00
Robert Osfield
b1dbb9e96b Added CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 2009-06-17 15:10:04 +00:00
Robert Osfield
4f6add4c14 Fixed error in DisplaySetting::setNumOfHttpDatabaseThreadsHint() 2009-06-17 08:55:53 +00:00
Robert Osfield
edb1eede40 From Konstantin Sinitsyn, "I've fixed bug with loading of compressed texture to texture array!"
Merged from svn/trunk using:

svn merge -r 10336:10337 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osg
2009-06-12 09:53:42 +00:00
Robert Osfield
9cccbcd7b7 From Mathias Froehlich, "Without this change packed depth stencil attachments are only supported if the
GL_EXT_framebuffer_blit extension is available. This is due to the early
return from the constructor if this is missing.
As far as I read the standard extension documents, this blit call is not
required to have packed depth stencil fbos.
The change fixes this and allows packed stencil attachments on machines
without the multisample blit command."

Merged from svn/trunk using:

svn merge -r 10326:10327 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk
2009-06-08 13:53:05 +00:00
Robert Osfield
1bf529b391 From Lionel Largade, "this correction makes the intensity interpolated in the correct direction when the angle is between _cosFadeAngle and _cosAngle."
Merged from svn/trunk using:

   svn merge -r 10320:10321 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgSim
2009-06-08 11:14:37 +00:00
Robert Osfield
83b84eb2f4 Introduced depend_on template and usage in RenderBin.cpp's singleton to solve crash on exit in static builds. 2009-06-06 10:08:43 +00:00
Paul MELIS
90325a5895 Fixed incorrect ENDIF() in applications/osgversion/CMakeLists.txt
(CMake 2.4 complained about this, while 2.6 seems to ignore it)
2009-06-04 19:22:06 +00:00
Robert Osfield
c2bc684eb2 Update ChangeLog and NEWS 2009-06-02 14:48:36 +00:00
Robert Osfield
5b439806ce Merged from svn/trunk : "Moved assigned of texture object to
_textureObjectBuffer to earlier in Texture2D::apply() to prevent
problems with non power of two texture mipmap generation."
2009-06-02 14:44:33 +00:00
Robert Osfield
5574c50607 Updated ChangeLog and NEWS.txt in prep for 2.8.2 2009-06-02 14:42:07 +00:00
Robert Osfield
31cb807db3 Updated version numbers for 2.8.2 release 2009-06-02 09:23:47 +00:00
Robert Osfield
3326c26a60 Merged from svn/trunk : "Fixed handling of case where the
master and the slave camera are placed on the same
          GraphisContext, or when the master camera and slave camera are
          assigned to different Camers. Note normally one doesn't mix
          master with GraphicsContexts and slave cameras so neither case is
          common."
2009-06-02 09:20:20 +00:00
Robert Osfield
8d70cc0b0f Merged from svn/trunk: "Added initializer of ParticleSystemUpdater::_frameNumber" 2009-06-02 09:17:48 +00:00
Robert Osfield
3558d1d010 Merged from svn/trunk two submissions:
"Refactored the adaption of X11 key symbols into OSG key events to fix problems with handling wide range of locales."

From Mathias Froehlich, "This frees some memory that is allocated by the X11 functions."
2009-06-02 09:16:11 +00:00
Robert Osfield
be47c9f44a Merged from svn/trunk. 2009-06-02 09:15:03 +00:00
Robert Osfield
6dab8c3380 From Emmanuel Roche, "I've also updated
the computeBound() method from the osg::Transform class : this
          method was using float based temporary variables and thus the
          double precision is lost here. I've changed that to use the
          generic types osg::BoundingSphere::vec_type and
          osg::BoundingSphere::value_type instead."

Merged from svn/trunk.
2009-06-02 09:14:04 +00:00
Robert Osfield
bbc8e7b58c Fixed glStencilMask setting. 2009-05-27 12:11:58 +00:00
Robert Osfield
9d8c98395e Refactored the GraphicsWindowX11::adaptKey() implementation so that it always uses the reampX11Key(ks) method, and for the mapping to handle case correctly. Merged from svn/trunk revision. 2009-05-25 16:36:11 +00:00
56 changed files with 1121 additions and 291 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 2.8.1
OpenSceneGraph Library 2.8.2
372 Contributors:
373 Contributors:
Firstname Surname
-----------------
@@ -9,9 +9,9 @@ Don Burns
Marco Jez
Paul Martz
Mike Weiblen
Mathias Fr<46>hlich
Eric Wing
Stephan Huber
Mathias Fr<46>hlich
Brede Johansen
Geoff Michel
Farshid Lashkari
@@ -63,16 +63,16 @@ Alberto Luaces
Philip Lowman
Chris Denham
Melchior Franz
Serge Lages
Lionel Lagarde
Joran Jessurun
Frederic Marmond
David Fries
Bryan Thrall
Terry Welsh
Serge Lages
Joran Jessurun
Frederic Marmond
Boris Bralo
Yefei He
Tim Moore
Terry Welsh
Stephane Lamoliatte
Sondra Iverson
Rune Schmidt Jensen
@@ -176,6 +176,7 @@ Stephan Eilemann
Stanislav Blinov
Sergey Leontyev
Sebastian Messerschmidt
Rene Molenaar
Ralf Kern
Pierre Haritchabalet
Perry Miller
@@ -190,6 +191,7 @@ Max Bandazian
Mathew May
Martin Spott
Martijn Kragtwijk
Konstantin Sinitsyn
Kevin Moiule
Keith Steffen
Katharina Plugge
@@ -208,6 +210,7 @@ Frederic Bouvier
Ferdi Smit
Ewe Woessner
Erik den Dekker
Emmanuel Roche
Edgar Ellis
Don Leich
David Ergo
@@ -234,7 +237,6 @@ Tomas Hnilica
Tino Schwarze
Thomas Weidner
Thom Carlo
Tery Welsh
Steven Thomas
Simon Hammett
Sid Byce
@@ -250,7 +252,6 @@ Rob Bloemkool
Rick Pingry
Rick Appleton
Ricard Schmidt
Rene Molenaar
Reinhard Sainitzer
Rein Kadijk
Raymond de Vries
@@ -262,6 +263,7 @@ Philipp M
Petr Salinger
Paul Palumbo
Paul Fredrikson
Paul Fotheringham
Patrick Hartling
Parag Chaudhur
Panagiotis Papadakos
@@ -298,7 +300,6 @@ Lewis Harmon
Lars Nilson
Kyle Centers
Kristopher Bixler
Konstantin Sinitsyn
Karsten Weiss
Karl Heijdenberg
Jutta Sauer
@@ -332,7 +333,6 @@ Frank Lichtenheld
Ferdinand Cornelissen
Fajran Iman
Fabien Dachicourt
Emmanuel Roche
Edmond Gheury
Ed Ralston
Duvan Cope
@@ -346,6 +346,7 @@ Danny Valente
Daniel Stien
Dan Minor
Cyril Brulebois
Cory Riddell
Clay Fowler
Chuck Sembroski
Chuck Seberion

View File

@@ -1,3 +1,5 @@
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
IF(WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ELSE(WIN32)
@@ -28,7 +30,7 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
SET(OPENSCENEGRAPH_MINOR_VERSION 8)
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
SET(OPENSCENEGRAPH_PATCH_VERSION 2)
SET(OPENSCENEGRAPH_SOVERSION 55)
# set to 0 when not a release candidate, non zero means that any generated

View File

@@ -8,6 +8,6 @@ set(CTEST_PROJECT_NAME "OpenSceneGraph")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CET")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org")
set(CTEST_DROP_LOCATION "/CDashPublic/submit.php?project=OpenSceneGraph")
set(CTEST_DROP_SITE "cdash.openscenegraph.org")
set(CTEST_DROP_LOCATION "/submit.php?project=OpenSceneGraph")
set(CTEST_DROP_SITE_CDASH TRUE)

430
ChangeLog
View File

@@ -1,3 +1,433 @@
2009-07-28 06:02 robert
* CMakeLists.txt, NEWS.txt, README.txt: Updated dates for 2.8.2
stable release
2009-07-24 12:12 robert
* CTestConfig.cmake: From Jean-Sebastien Guay, updated CTestConfig
to point to new cdash.openscenegraph.org site
2009-07-17 07:50 robert
* src/osgPlugins/jpeg, src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:
From J.P. Delport, "attached a modified jpeg plugin that allows
writing of grayscale images."
2009-07-16 13:30 robert
* ChangeLog, NEWS.txt: Update ChangeLog and NEWS for 2.8.2-rc4
2009-07-16 13:18 robert
* CMakeLists.txt: Updated release candidate number to 4
2009-07-16 12:11 robert
* src/osgPlugins/OpenFlight,
src/osgPlugins/OpenFlight/FltExportVisitor.cpp: From Fabien
Lavignotte, "When exporting some models to OpenFlight, i found a
crash if the texture
unit does not contain a TexEnv object.
Here's the small fix, just a test on the pointer."
Merged from svn trunk using:
svn merge -r 10490:10491
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight
2009-07-16 12:06 robert
* src/osgWidget, src/osgWidget/Window.cpp: From Stephane
Lamoliatte, "The vertical anchor is inverted in the
osgWidget::Window::update function.
Here is a small patch to fix that."
2009-07-16 11:52 robert
* examples/osganimationtimeline,
examples/osganimationtimeline/osganimationtimeline.cpp: From
Cedric Pinson, crash fix for osganimationtimeline that was caused
by not checking if nathan.osg test file had be loaded or not.
2009-07-16 11:42 robert
* src/osgPlugins/bsp, src/osgPlugins/bsp/VBSPEntity.cpp,
src/osgPlugins/bsp/VBSPEntity.h,
src/osgPlugins/bsp/VBSPGeometry.cpp,
src/osgPlugins/bsp/VBSPReader.cpp, src/osgPlugins/mdl,
src/osgPlugins/mdl/MDLReader.cpp,
src/osgPlugins/mdl/MDL_README.txt: From Jason Daly, "These are
some fixes to the mdl and bsp plugins to handle transparency and
lighting better, plus a few other tweaks."
2009-07-16 11:09 robert
* src/osgUtil/Optimizer.cpp: From Colin MacDonald, "The Optimizer
Merge Geometry visitor is always merging geometries,
even if they have had DataVariance DYNAMIC explicitly specified.
Then
when an application attempts to dynamically update the geometry
in the
frame loop the primitive sets and data arrays are no longer as
expected, leading to display and/or memory corruption.
Attached is a simple fix."
Note from Robert Osfield, tweaked Colin's changes so that it uses
!= DYNAMIC rather == STATIC in the additional test.
Merged from svn/trunk using:
svn merge -r 10479:10480
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
2009-07-14 16:02 robert
* NEWS.txt: Tweaked news
2009-07-14 15:49 robert
* AUTHORS.txt, CMakeLists.txt, ChangeLog, NEWS.txt,
applications/osgversion/Contributors.cpp: Updated contributors,
authors file, news and changelog for 2.8.2-rc3
2009-07-13 16:45 robert
* src/osgViewer, src/osgViewer/GraphicsWindowWin32.cpp: From Cory
Riddell based on suggestion from Robert Osfield, "I've been
running with your suggested changes for a few days now and it
has been working perfectly. I'm still not entirely clear why
adding a
slave/subgraph causes the problem."
2009-07-13 16:07 robert
* src/OpenThreads/win32,
src/OpenThreads/win32/Win32ConditionPrivateData.h: From David
Fries, "Here is a fix for a deadlock seen under Windows using
OpenThreads
Barrier operations. The error is with atomic operations in the
win32 condition implementation. The attached sample program will
reliably trigger with as few as three threads and a dual core
system,
though sometimes it will take 65,000 iterations.
2.8.1 was the base for these changes
Win32ConditionPrivateData.h
Win32ConditionPrivateData::wait does two operations to decrement
waiters_ then read, when InterlockedDecrement decrements and
returns
the value in one operation. The two operations allows another
thread
to also decrement with both getting 0 for an answer.
Win32ConditionPrivateData::broadcast is using waiters_ directly
instead of using the w value read earlier, if it was safe to use
waiters_ directly there would be no need for InterlockedGet or w.
overview of deadlock in barrier with three threads
one thread in broadcast, 2 threads in wait,
release semaphore 2, waits on waiters_done_
both threads wake, decrement waiters_, get 0 for w,
<logic error here>
one calls set waiters_done_,
broadcast thread comes out of waiters_done_,
other thread calls waiters_done_, (which leaves waiters_done_ in
the
signaled state)
<sets the trap>
broadcast thread returns releases mutex, other threads get
mutex and also return,
next barrier, first two threads enter wait, one goes to
broadcast, release
semaphore 2, skips waiters_done_ as it had been released last
time
returns, processes, enters the barrier for the next barrier
operation
and waits,
three threads are now in wait, two have the previous barrier
phase,
one the current phase, there's one count left in the semaphore
which a
thread gets, returns, enters the barrier as a waiter, sleeps, and
the
deadlock is completed"
Merged from svn/trunk using:
svn merge -r 10456:10457
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/OpenThreads/win32
2009-07-03 19:08 robert
* src/osgPlugins/dicom/CMakeLists.txt: From Paul Fotheringham,
fixed linux build error when compiling dicom plugin against ITK
by adding define VCL_CAN_STATIC_CONST_INIT_FLOAT to be zero.
From Robert Osfield, general clean up of CMakeLists.txt under ITK
side
2009-07-01 15:39 robert
* src/osgPlugins/OpenFlight/ExportOptions.cpp: From Bryan Thrall,
"The OpenFlight plugin doesn't handle unrecognized options or
extra
whitespace in all cases, causing it to crash."
2009-06-29 09:50 robert
* NEWS.txt, README.txt: Updated NEWS for and READE for 2.9.2-rc2.
2009-06-29 09:47 robert
* CMakeLists.txt: Updated release candidate to 2
2009-06-29 09:46 robert
* examples/osgshadow/osgshadow.cpp: Made --pssm and --sv options
use SingleThreaded viewer to workaround threading issues with
ParallelSplitShadowMap and ShadowVolume techniques.
2009-06-25 16:08 robert
* NEWS.txt: Updated to NEWS to map to wiki NEWS item
2009-06-25 14:06 robert
* src/osg/ArgumentParser.cpp, src/osg/CullSettings.cpp,
src/osg/DisplaySettings.cpp, src/osgDB/DatabasePager.cpp,
src/osgGA/DriveManipulator.cpp,
src/osgPlugins/bsp/VBSPEntity.cpp,
src/osgPlugins/cfg/ConfigParser.cpp,
src/osgPlugins/dw/ReaderWriterDW.cpp,
src/osgPlugins/ive/DataOutputStream.cpp,
src/osgPlugins/normals/ReaderWriterNormals.cpp,
src/osgPlugins/txp/ReaderWriterTXP.cpp,
src/osgPlugins/txp/TXPParser.cpp,
src/osgViewer/ViewerEventHandlers.cpp: From Mathias Froehlich,
changes from atof to use osg::asciiToFloat() to avoid locale
issues with atof
2009-06-25 13:27 robert
* include/osg, include/osg/Endian: From Mathias Froehlich, "Fix
possible problem with aliasing rules... and fix a gcc warning :)
Use a union to determine if we are on a little endian or big
endian machine."
Merged from svn/trunk using :
svn merge -r 10409:10410
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/include/osg/
2009-06-22 16:04 robert
* src/osgPlugins/txp, src/osgPlugins/txp/trpage_swap.cpp: Fixed
swap size error.
Merged from svn/trunk using:
svn merge -r 10386:10387
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgPlugins/txp/
2009-06-22 09:32 robert
* AUTHORS.txt, ChangeLog, NEWS.txt,
applications/osgversion/Contributors.cpp: Updated NEWS, AUTHORS
and ChangeLog for 2.8.2-rc1 release
2009-06-22 07:42 robert
* src/osgPlugins/osg/StateSet.cpp: Merged from svn/trunk fix to
initGLNames() which addressed thread safety issue
2009-06-20 11:38 robert
* src/osgText/TextBase.cpp: From Farshid Lashkari, "I found a bug
in the osgText library in version 1.2 that I believe still exists
in the latest version.
I found that changing the alignment of a text object does not
work properly if the text contains newline characters. I've
attached a simple test case that shows the problem. If I set the
text AFTER setting the alignment, everything works fine. But if I
set the text BEFORE setting the alignment then the text is
displayed incorrectly.
The fix is very simple. Instead of calling computePositions() in
TextBase::setAlignment(), it calls computeGlyphRepresentation().
I've attached the modified TextBase.cpp."
Merged from svn/trunk using:
svn merge -r 10375:10376
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgText/TextBase.cpp
2009-06-19 11:02 robert
* src/osgViewer, src/osgViewer/CompositeViewer.cpp,
src/osgViewer/GraphicsWindowWin32.cpp, src/osgViewer/Viewer.cpp:
Added clears of input vectors in various get*() methods
2009-06-19 10:44 robert
* ChangeLog: Updated ChangeLog
2009-06-18 08:19 robert
* src/osgManipulator, src/osgManipulator/AntiSquish.cpp: From Rene
Molenaar, "The bug is as described above:
"The dragger's corner tabs are no longer in the corners."
this fix places the cornertabs back in the corners.
(the manipulator does not make sense otherwise)."
2009-06-17 15:10 robert
* CMakeLists.txt: Added CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS
2009-06-17 08:55 robert
* include/osg/DisplaySettings: Fixed error in
DisplaySetting::setNumOfHttpDatabaseThreadsHint()
2009-06-12 09:53 robert
* src/osg/Texture2DArray.cpp: From Konstantin Sinitsyn, "I've fixed
bug with loading of compressed texture to texture array!"
Merged from svn/trunk using:
svn merge -r 10336:10337
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osg
2009-06-08 13:53 robert
* src/osg: From Mathias Froehlich, "Without this change packed
depth stencil attachments are only supported if the
GL_EXT_framebuffer_blit extension is available. This is due to
the early
return from the constructor if this is missing.
As far as I read the standard extension documents, this blit call
is not
required to have packed depth stencil fbos.
The change fixes this and allows packed stencil attachments on
machines
without the multisample blit command."
Merged from svn/trunk using:
svn merge -r 10326:10327
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk
2009-06-08 11:14 robert
* src/osgSim, src/osgSim/Sector.cpp: From Lionel Largade, "this
correction makes the intensity interpolated in the correct
direction when the angle is between _cosFadeAngle and _cosAngle."
Merged from svn/trunk using:
svn merge -r 10320:10321
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgSim
2009-06-06 10:08 robert
* include/osg/Referenced, src/osgUtil/RenderBin.cpp: Introduced
depend_on template and usage in RenderBin.cpp's singleton to
solve crash on exit in static builds.
2009-06-04 19:22 paulmelis
* applications/osgversion/CMakeLists.txt: Fixed incorrect ENDIF()
in applications/osgversion/CMakeLists.txt
(CMake 2.4 complained about this, while 2.6 seems to ignore it)
2009-06-02 14:48 robert
* ChangeLog, NEWS.txt: Update ChangeLog and NEWS
2009-06-02 14:44 robert
* src/osg/Texture2D.cpp: Merged from svn/trunk : "Moved assigned of
texture object to
_textureObjectBuffer to earlier in Texture2D::apply() to prevent
problems with non power of two texture mipmap generation."
2009-06-02 14:42 robert
* ChangeLog, NEWS.txt: Updated ChangeLog and NEWS.txt in prep for
2.8.2
2009-06-02 09:23 robert
* CMakeLists.txt, include/osg/Version: Updated version numbers for
2.8.2 release
2009-06-02 09:20 robert
* src/osg/GraphicsContext.cpp: Merged from svn/trunk : "Fixed
handling of case where the
master and the slave camera are placed on the same
GraphisContext, or when the master camera and slave camera are
assigned to different Camers. Note normally one doesn't mix
master with GraphicsContexts and slave cameras so neither case is
common."
2009-06-02 09:17 robert
* src/osgParticle/ParticleSystemUpdater.cpp: Merged from svn/trunk:
"Added initializer of ParticleSystemUpdater::_frameNumber"
2009-06-02 09:16 robert
* src/osgViewer/GraphicsWindowX11.cpp: Merged from svn/trunk two
submissions:
"Refactored the adaption of X11 key symbols into OSG key events
to fix problems with handling wide range of locales."
From Mathias Froehlich, "This frees some memory that is allocated
by the X11 functions."
2009-06-02 09:15 robert
* src/osgUtil/GLObjectsVisitor.cpp: Merged from svn/trunk.
2009-06-02 09:14 robert
* src/osg/Transform.cpp: From Emmanuel Roche, "I've also updated
the computeBound() method from the osg::Transform class : this
method was using float based temporary variables and thus the
double precision is lost here. I've changed that to use the
generic types osg::BoundingSphere::vec_type and
osg::BoundingSphere::value_type instead."
Merged from svn/trunk.
2009-05-27 12:11 robert
* src/osgUtil/RenderStage.cpp: Fixed glStencilMask setting.
2009-05-25 16:36 robert
* src/osgViewer/GraphicsWindowX11.cpp: Refactored the
GraphicsWindowX11::adaptKey() implementation so that it always
uses the reampX11Key(ks) method, and for the mapping to handle
case correctly. Merged from svn/trunk revision.
2009-05-19 16:21 robert
* AUTHORS.txt: Updated AUTHORS file to 2.8.1 release
2009-05-19 16:08 robert
* ChangeLog: Updated ChangeLog for 2.8.1 release
2009-05-19 16:05 robert
* CMakeLists.txt, NEWS.txt, README.txt: Updated dates and reset

117
NEWS.txt
View File

@@ -1,6 +1,123 @@
OSG News
========
= !OpenSceneGraph 2.8.2 release - bug fix release =
PERTHSHIRE, Scotland - 28th July 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The !OpenSceneGraph 2.8.2 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
=== Updates between 2.8.2 and 2.8.1 releases include: ===
* Build fixes for:
* !RedHat Enterprise Linux
* Building of dicom plugin with ITK under Linux
* Crash fixes to:
* crash during window destruction under Windows when using closing a MFC based !GraphicsWindow
* deadlock under Windows due threading issues with atomic operations in Win32 Barrier implementation
* !OpenFlight plugin crashed due to not handling spaces at the end of option strings
* !OpenFlight plugin crashed when exported scene graphs contain no TexEnv objects
* osganimationtimeline crashed when example model was not found
* Bug fixes to :
* vertical anchor in osgWidget::Widow was inverted
* bsp an mdl plugins to better handling transparency and lighting
* computation of sector range in osgSim::!LightPoint
* extension checking of FBO packed stencil support
* position of tabs at corners of manipulators
* threading bug in .osg plugin that occurred during multi-threaded initialization
* alignment of Text what setting alignment after assign text string
* loading of compressed texture arrays
* texture generate mipmap for non power of two textures
* regression in X11 key symbol remapping, improved support for Russian keyboards
* regression of !StencilMask setting in !RenderStage
* small memory leak in X11 usage
* Transform::computeBound() double !BoundingSphere support
* Resize handling when master and slave Cameras share the same !GraphicsContext
* Handling of locale in plugins and env var parsing so it always follows the '.' decimal place convention regardless of the desktop/application locale.
=== Updates between 2.8.1 and 2.8.0 releases include: ===
* Build fixes under FreeBSD and IBM AIX, and RedHat Enterprise Linux
* Improved compatibility with SWIG wrapper building
* Crash fixes in osg::State, osg::Geometry and osgWidget
* Bug fixes to :
* draw instanced support
* Optimizer - MergeGeometryVisitor, RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
* hdr image loader
* handling of opacity maps in 3ds loader
* dxf loader
* frame buffer object
* cursor/event handling in windows
* windows threading
* memory leak in Collada loader
* fixes to display lists/vbo creation that prevent crash under ATI drivers
* subface PolygonOffset setting in OpenFlight
* osgconv --formats under OSX
* osgTerrain::Layer bounding volume calculation
=== Updates between 2.8 and 2.6 include: ===
* New osgVolume library for volume rendering, with support for:
* High quality GPU based Ray tracing
* Transfer functions
* Per pixel lighting
* Iso surface rendering
* Maximum Intensity Projection rendering
* Non-power-of-two 3D textures, and 3D texture compression
* DICOM loading for reading dicom medical data
* New osgAnimation library for character and scene animation.
* New plugin for reading Biovision hierarchical files (.BVH) to generate character motion animations.
* New osgShadow support for Light Space Perspective Shadow Maps (LispSM).
* Three new scene graph widgets for placing traditional 2D capability into fully interactive 3D scenes:
* PDF widget (based on libPoppler)
* VNC client widget (based on libVNCServer)
* Internet browser client widget (based on Gecko/UBrowser)
* New plugins for loading Half-Life 2 maps and models.
* New plugin for loading EXR, high dynamic range imagery
* Improvements to !DatabasePager, tailored for low latency paging.
* Improved runtime stats collection and on screen reporting.
* Performance improvements through optimization of matrix operations.
* Support for the OpenGL "draw instanced" extension.
* Support for zlib compressed native .ive and .gz files
* Improvements to COLLADA support.
* Build reporting using CDash
* New packaging support using CPack
* A wide range of build and bug fixes
=== Downloads and Licensing ===
!OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/projects/osg/wiki/Downloads Downloads] section of the openscenegraph.org website.
!OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the !OpenSceneGraph libraries without restricting the licensing of the user's software.
=== !OpenSceneGraph Books now available ===
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual, books can be found at [http://www.osgbooks.com OsgBooks].
=== Professional support and services ===
!OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both based in the USA, and a range of [wiki:Community/Contractors Contractors] from around the world. Services available include:
* Confidential Professional Support
* Bespoke development
* Consultancy
* Training
=== Community support and contributions ===
The diverse and growing community of over 2000 developers is centred around the public osg-users mailing list, where members discuss how best to use !OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
The !OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/projects/osg/wiki/Support/Contributors/TwoPointEight 365 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
----
About !OpenSceneGraph: [[BR]]
The !OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
About !OpenSceneGraph Professional Services:[[BR]]
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
----------------------------------------------------------------------------------------
= !OpenSceneGraph 2.8.1 release - bug fix release =
PERTHSHIRE, Scotland - 19th May 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.

View File

@@ -14,7 +14,7 @@ subscribe to our public mailing list:
Robert Osfield.
Project Lead.
19th May 2009.
28th July 2009.
--

View File

@@ -3,7 +3,7 @@ SET(TARGET_SRC osgversion.cpp )
IF (OSG_MAINTAINER)
SET(TARGET_SRC ${TARGET_SRC} Contributors.cpp )
ADD_DEFINITIONS("-DBUILD_CONTRIBUTORS")
ENDIF()
ENDIF(OSG_MAINTAINER)
SET(TARGET_COMMON_LIBRARIES
OpenThreads

View File

@@ -311,6 +311,7 @@ TypoCorrection typoCorrections[] =
{"Keuhne", "Kuehne"},
{"Kheune", "Kuehne"},
{"Lagrade", "Lagarde"},
{"Largade", "Lagarde"},
{"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"},
@@ -377,6 +378,7 @@ TypoCorrection typoCorrections[] =
{"Sylvan", "Sylvain"},
{"Takeahei", "Takahei"},
{"Takehei", "Takahei"},
{"Tery", "Terry"},
{"Tarantilils", "Tarantilis"},
{"Trastenjak", "Trstenjak"},
{"Urlich", "Ulrich"},

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* 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
@@ -157,22 +157,26 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
int main (int argc, char* argv[])
{
std::cerr << "This example works only with osgAnimation/nathan.osg" << std::endl;
std::cerr << "This example works only with nathan.osg" << std::endl;
osg::ArgumentParser psr(&argc, argv);
osgViewer::Viewer viewer(psr);
std::string file = "osgAnimation/nathan.osg";
std::string file = "nathan.osg";
if(argc >= 2)
file = psr[1];
// replace the manager
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
if (!root) {
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
return 1;
}
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
{
std::cerr << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
return 1;
}

View File

@@ -600,6 +600,9 @@ int main(int argc, char** argv)
if (arguments.read("--sv"))
{
// sv isn't yet thread safe
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// hint to tell viewer to request stencil buffer when setting up windows
osg::DisplaySettings::instance()->setMinimumNumStencilBits(8);
@@ -622,6 +625,9 @@ int main(int argc, char** argv)
}
else if (arguments.read("--pssm"))
{
// pssm isn't yet thread safe
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
int mapcount = 3;
while (arguments.read("--mapcount", mapcount));
osg::ref_ptr<osgShadow::ParallelSplitShadowMap> pssm = new osgShadow::ParallelSplitShadowMap(NULL,mapcount);

View File

@@ -191,7 +191,7 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
unsigned int getNumOfDatabaseThreadsHint() const { return _numDatabaseThreadsHint; }
/** Set the hint for number of threads in the DatbasePager to dedicate to reading http requests.*/
void setNumOfHttpDatabaseThreadsHint(unsigned int numThreads) { _numDatabaseThreadsHint = numThreads; }
void setNumOfHttpDatabaseThreadsHint(unsigned int numThreads) { _numHttpDatabaseThreadsHint = numThreads; }
/** Get the hint for number of threads in the DatbasePager dedicated to reading http requests.*/
unsigned int getNumOfHttpDatabaseThreadsHint() const { return _numHttpDatabaseThreadsHint; }

View File

@@ -26,9 +26,14 @@ enum Endian
inline Endian getCpuByteOrder()
{
static char big_endian_1[2] = { 0, 1 };
union {
char big_endian_1[2];
short is_it_really_1;
} u;
u.big_endian_1[0] = 0;
u.big_endian_1[1] = 1;
if ( (*((short*) big_endian_1)) == 1)
if (u.is_it_really_1 == 1)
return BigEndian;
else
return LittleEndian;

View File

@@ -31,6 +31,13 @@ namespace osg {
class DeleteHandler;
class Observer;
/** template class to help enforce static initialization order. */
template <typename T, T M()>
struct depends_on
{
depends_on() { M(); }
};
/** Base class from providing referencing counted objects.*/
class OSG_EXPORT Referenced
{

View File

@@ -21,7 +21,7 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 2
#define OPENSCENEGRAPH_MINOR_VERSION 8
#define OPENSCENEGRAPH_PATCH_VERSION 1
#define OPENSCENEGRAPH_PATCH_VERSION 2
#define OPENSCENEGRAPH_SOVERSION 55
/**

View File

@@ -68,7 +68,7 @@ public:
if (have_waiters)
{
// Wake up all the waiters.
ReleaseSemaphore(sema_.get(),waiters_,NULL);
ReleaseSemaphore(sema_.get(), w, NULL);
cooperativeWait(waiters_done_.get(), INFINITE);
@@ -112,8 +112,7 @@ public:
}
catch(...){
// thread is canceled in cooperative wait , do cleanup
InterlockedDecrement(&waiters_);
long w = InterlockedGet(&waiters_);
long w = InterlockedDecrement(&waiters_);
int last_waiter = was_broadcast_ && w == 0;
if (last_waiter) SetEvent(waiters_done_.get());
@@ -123,8 +122,7 @@ public:
// We're ready to return, so there's one less waiter.
InterlockedDecrement(&waiters_);
long w = InterlockedGet(&waiters_);
long w = InterlockedDecrement(&waiters_);
int last_waiter = was_broadcast_ && w == 0;
if (result != -1 && last_waiter)

View File

@@ -16,6 +16,7 @@
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Math>
#include <osg/Notify>
#include <set>
@@ -163,8 +164,8 @@ bool ArgumentParser::Parameter::assign(const char* str)
*_value._bool = (strcmp(str,"True")==0 || strcmp(str,"true")==0 || strcmp(str,"TRUE")==0);
break;
}
case Parameter::FLOAT_PARAMETER: *_value._float = atof(str); break;
case Parameter::DOUBLE_PARAMETER: *_value._double = atof(str); break;
case Parameter::FLOAT_PARAMETER: *_value._float = osg::asciiToFloat(str); break;
case Parameter::DOUBLE_PARAMETER: *_value._double = osg::asciiToDouble(str); break;
case Parameter::INT_PARAMETER: *_value._int = atoi(str); break;
case Parameter::UNSIGNED_INT_PARAMETER: *_value._uint = atoi(str); break;
case Parameter::STRING_PARAMETER: *_value._string = str; break;

View File

@@ -111,7 +111,7 @@ void CullSettings::readEnvironmentalVariables()
if ((ptr = getenv("OSG_NEAR_FAR_RATIO")) != 0)
{
_nearFarRatio = atof(ptr);
_nearFarRatio = osg::asciiToDouble(ptr);
osg::notify(osg::INFO)<<"Set near/far ratio to "<<_nearFarRatio<<std::endl;
}

View File

@@ -13,6 +13,7 @@
#include <osg/DisplaySettings>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Math>
#include <osg/Notify>
#include <osg/ref_ptr>
@@ -267,22 +268,22 @@ void DisplaySettings::readEnvironmentalVariables()
if( (ptr = getenv("OSG_EYE_SEPARATION")) != 0)
{
_eyeSeparation = atof(ptr);
_eyeSeparation = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_WIDTH")) != 0)
{
_screenWidth = atof(ptr);
_screenWidth = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_HEIGHT")) != 0)
{
_screenHeight = atof(ptr);
_screenHeight = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SCREEN_DISTANCE")) != 0)
{
_screenDistance = atof(ptr);
_screenDistance = osg::asciiToFloat(ptr);
}
if( (ptr = getenv("OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING")) != 0)

View File

@@ -819,6 +819,7 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height)
osg::View* view = camera->getView();
osg::View::Slave* slave = view ? view->findSlaveForCamera(camera) : 0;
if (slave)
{
if (camera->getReferenceFrame()==osg::Transform::RELATIVE_RF)
@@ -849,6 +850,29 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height)
case(osg::Camera::VERTICAL): camera->getProjectionMatrix() *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break;
default: break;
}
osg::Camera* master = view ? view->getCamera() : 0;
if (view && camera==master)
{
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
{
osg::View::Slave& child = view->getSlave(i);
if (child._camera.valid() && child._camera->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
// scale the slaves by the inverse of the change that has been applied to master, to avoid them be
// scaled twice (such as when both master and slave are on the same GraphicsContexts) or by the wrong scale
// when master and slave are on different GraphicsContexts.
switch(policy)
{
case(osg::Camera::HORIZONTAL): child._projectionOffset *= osg::Matrix::scale(aspectRatioChange,1.0,1.0); break;
case(osg::Camera::VERTICAL): child._projectionOffset *= osg::Matrix::scale(1.0, 1.0/aspectRatioChange,1.0); break;
default: break;
}
}
}
}
}
}

View File

@@ -194,14 +194,13 @@ void Texture2D::apply(State& state) const
// compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat();
// compute the dimensions of the texture.
computeRequiredTextureDimensions(state,*image,_textureWidth, _textureHeight, _numMipmapLevels);
textureObject = generateTextureObject(
_textureObjectBuffer[contextID] = textureObject = generateTextureObject(
contextID,GL_TEXTURE_2D,_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D,state);
@@ -217,16 +216,13 @@ void Texture2D::apply(State& state) const
//notify(NOTICE)<<"Creating new texture object"<<std::endl;
applyTexImage2D_load(state,GL_TEXTURE_2D,image.get(),
_textureWidth, _textureHeight, _numMipmapLevels);
textureObject->setAllocated(true);
}
// update the modified tag to show that it is upto date.
getModifiedCount(contextID) = image->getModifiedCount();
_textureObjectBuffer[contextID] = textureObject;
if (_unrefImageDataAfterApply && areAllTextureObjectsLoaded() && image->getDataVariance()==STATIC)
{
Texture2D* non_const_this = const_cast<Texture2D*>(this);

View File

@@ -420,7 +420,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
numMipmapLevels = 1;
GLint blockSize, size;
getCompressedSize(_internalFormat, inwidth, inheight, indepth, blockSize,size);
getCompressedSize(_internalFormat, inwidth, inheight, 1, blockSize,size);
extensions->glCompressedTexSubImage3D(target, 0,
0, 0, indepth,

View File

@@ -163,29 +163,28 @@ BoundingSphere Transform::computeBound() const
computeLocalToWorldMatrix(l2w,NULL);
Vec3 xdash = bsphere._center;
osg::BoundingSphere::vec_type xdash = bsphere._center;
xdash.x() += bsphere._radius;
xdash = xdash*l2w;
Vec3 ydash = bsphere._center;
osg::BoundingSphere::vec_type ydash = bsphere._center;
ydash.y() += bsphere._radius;
ydash = ydash*l2w;
Vec3 zdash = bsphere._center;
osg::BoundingSphere::vec_type zdash = bsphere._center;
zdash.z() += bsphere._radius;
zdash = zdash*l2w;
bsphere._center = bsphere._center*l2w;
xdash -= bsphere._center;
float len_xdash = xdash.length();
osg::BoundingSphere::value_type len_xdash = xdash.length();
ydash -= bsphere._center;
float len_ydash = ydash.length();
osg::BoundingSphere::value_type len_ydash = ydash.length();
zdash -= bsphere._center;
float len_zdash = zdash.length();
osg::BoundingSphere::value_type len_zdash = zdash.length();
bsphere._radius = len_xdash;
if (bsphere._radius<len_ydash) bsphere._radius = len_ydash;

View File

@@ -885,7 +885,7 @@ DatabasePager::DatabasePager()
_expiryDelay = 10.0;
if( (ptr = getenv("OSG_EXPIRY_DELAY")) != 0)
{
_expiryDelay = atof(ptr);
_expiryDelay = osg::asciiToDouble(ptr);
osg::notify(osg::NOTICE)<<"Expiry delay = "<<_expiryDelay<<std::endl;
}
@@ -904,7 +904,7 @@ DatabasePager::DatabasePager()
}
else
{
setReleaseDelay(atof(ptr));
setReleaseDelay(osg::asciiToDouble(ptr));
}
osg::notify(osg::NOTICE)<<"Release delay = "<<_releaseDelay<<std::endl;
@@ -943,7 +943,7 @@ DatabasePager::DatabasePager()
_maximumNumOfObjectsToCompilePerFrame = 4;
if( (ptr = getenv("OSG_MINIMUM_COMPILE_TIME_PER_FRAME")) != 0)
{
_minimumTimeAvailableForGLCompileAndDeletePerFrame = atof(ptr);
_minimumTimeAvailableForGLCompileAndDeletePerFrame = osg::asciiToDouble(ptr);
}
if( (ptr = getenv("OSG_MAXIMUM_OBJECTS_TO_COMPILE_PER_FRAME")) != 0)

View File

@@ -36,7 +36,7 @@ static double getHeightOfDriver()
double height = 1.5;
if (getenv("OSG_DRIVE_MANIPULATOR_HEIGHT"))
{
height = atof(getenv("OSG_DRIVE_MANIPULATOR_HEIGHT"));
height = osg::asciiToDouble(getenv("OSG_DRIVE_MANIPULATOR_HEIGHT"));
}
osg::notify(osg::INFO)<<"DriveManipulator::_height set to =="<<height<<std::endl;
return height;

View File

@@ -148,9 +148,9 @@ osg::Matrix AntiSquish::computeUnSquishedMatrix(const osg::Matrix& LTW, bool& fl
// Position
if (_usePosition)
unsquished.postMult(_position);
unsquished.postMultTranslate(_position);
else
unsquished.postMult(_pivot);
unsquished.postMultTranslate(_pivot);
}
else
{

View File

@@ -12,7 +12,7 @@ osgParticle::ParticleSystemUpdater::ParticleSystemUpdater()
}
osgParticle::ParticleSystemUpdater::ParticleSystemUpdater(const ParticleSystemUpdater& copy, const osg::CopyOp& copyop)
: osg::Node(copy, copyop), _t0(copy._t0)
: osg::Node(copy, copyop), _t0(copy._t0), _frameNumber(0)
{
ParticleSystem_Vector::const_iterator i;
for (i=copy._psv.begin(); i!=copy._psv.end(); ++i) {

View File

@@ -163,6 +163,12 @@ ExportOptions::parseOptionsString()
setStripTextureFilePath( true );
continue;
}
// Protect against unrecognized options without values
if ( pos == str.npos )
{
osg::notify( osg::WARN ) << "fltexp: Bogus OptionString: " << token << std::endl;
continue;
}
// Not a Boolean/toggle. Must have a value.
// Get the value of the token, which could be double-quoted.

View File

@@ -647,24 +647,27 @@ FltExportVisitor::writeATTRFile( int unit, const osg::Texture2D* texture ) const
const osg::StateSet* ss = getCurrentStateSet();
const osg::TexEnv* texenv = dynamic_cast<const osg::TexEnv*>(
ss->getTextureAttribute( unit, osg::StateAttribute::TEXENV ) );
switch( texenv->getMode())
if (texenv)
{
case osg::TexEnv::DECAL:
ad.texEnvMode = AttrData::TEXENV_DECAL;
break;
case osg::TexEnv::MODULATE:
default:
ad.texEnvMode = AttrData::TEXENV_MODULATE;
break;
case osg::TexEnv::BLEND:
ad.texEnvMode = AttrData::TEXENV_BLEND;
break;
case osg::TexEnv::REPLACE:
ad.texEnvMode = AttrData::TEXENV_COLOR;
break;
case osg::TexEnv::ADD:
ad.texEnvMode = AttrData::TEXENV_ADD;
break;
switch( texenv->getMode())
{
case osg::TexEnv::DECAL:
ad.texEnvMode = AttrData::TEXENV_DECAL;
break;
case osg::TexEnv::MODULATE:
default:
ad.texEnvMode = AttrData::TEXENV_MODULATE;
break;
case osg::TexEnv::BLEND:
ad.texEnvMode = AttrData::TEXENV_BLEND;
break;
case osg::TexEnv::REPLACE:
ad.texEnvMode = AttrData::TEXENV_COLOR;
break;
case osg::TexEnv::ADD:
ad.texEnvMode = AttrData::TEXENV_ADD;
break;
}
}
osgDB::writeObjectFile( ad, name, _fltOpt.get() );

View File

@@ -181,7 +181,7 @@ void VBSPEntity::processItem()
Vec3f VBSPEntity::getVector(std::string str)
{
double x, y, z;
float x, y, z;
// Look for the first non-whitespace
std::string::size_type start = str.find_first_not_of(" \t\r\n", 0);
@@ -190,7 +190,7 @@ Vec3f VBSPEntity::getVector(std::string str)
std::string::size_type end = str.find_first_of(" \t\r\n", start);
if ((end > start) && (start != std::string::npos))
x = atof(str.substr(start, end-start).c_str());
x = osg::asciiToFloat(str.substr(start, end-start).c_str());
else
return Vec3f();
@@ -201,7 +201,7 @@ Vec3f VBSPEntity::getVector(std::string str)
end = str.find_first_of(" \t\r\n", start);
if ((end > start) && (start != std::string::npos))
y = atof(str.substr(start, end-start).c_str());
y = osg::asciiToFloat(str.substr(start, end-start).c_str());
else
return Vec3f();
@@ -214,7 +214,7 @@ Vec3f VBSPEntity::getVector(std::string str)
end = str.length();
if ((end > start) && (start != std::string::npos))
z = atof(str.substr(start, end-start).c_str());
z = osg::asciiToFloat(str.substr(start, end-start).c_str());
else
return Vec3f();
@@ -315,45 +315,45 @@ void VBSPEntity::parseParameters(std::string & entityText)
}
// Get the class name and process the entity appropriately
std::string className = (*param).second;
if (className.compare("worldspawn") == 0)
class_name = (*param).second;
if (class_name.compare("worldspawn") == 0)
{
// This is the entity that represents the main geometry of the map
// (the terrain and much of the static geometry)
entity_class = ENTITY_WORLDSPAWN;
processWorldSpawn();
}
else if (className.compare(0, 3, "env") == 0)
else if (class_name.compare(0, 3, "env") == 0)
{
// This is an environmental effect (such as a fire or dust cloud)
entity_class = ENTITY_ENV;
processEnv();
}
else if ((className.compare("func_brush") == 0) ||
(className.compare("func_illusionary") == 0) ||
(className.compare("func_wall_toggle") == 0) ||
(className.compare("func_breakable") == 0))
else if ((class_name.compare("func_brush") == 0) ||
(class_name.compare("func_illusionary") == 0) ||
(class_name.compare("func_wall_toggle") == 0) ||
(class_name.compare("func_breakable") == 0))
{
// This is secondary map geometry, created along with the main
// map geometry (not an external model)
entity_class = ENTITY_FUNC_BRUSH;
processFuncBrush();
}
else if (className.compare(0, 4, "prop") == 0)
else if (class_name.compare(0, 4, "prop") == 0)
{
// This is a "prop", an external model placed somewhere in the
// scene
entity_class = ENTITY_PROP;
processProp();
}
else if (className.compare("infodecal") == 0)
else if (class_name.compare("infodecal") == 0)
{
// This is a decal, which applies a texture to some surface in the
// scene
entity_class = ENTITY_INFO_DECAL;
processInfoDecal();
}
else if (className.compare(0, 4, "item") == 0)
else if (class_name.compare(0, 4, "item") == 0)
{
// This is an "item". Like a prop, these are external models
// placed in the scene, but the specific model is determined
@@ -367,19 +367,20 @@ void VBSPEntity::parseParameters(std::string & entityText)
ref_ptr<Group> VBSPEntity::createBrushGeometry()
{
int i;
int numGeoms;
VBSPGeometry ** vbspGeomList;
Model currentModel;
Face currentFace;
TexInfo currentTexInfo;
TexData currentTexData;
const char * texName;
char currentTexName[256];
int currentGeomIndex;
VBSPGeometry * currentGeom;
ref_ptr<Group> entityGroup;
ref_ptr<Group> geomGroup;
int i;
int numGeoms;
VBSPGeometry ** vbspGeomList;
Model currentModel;
Face currentFace;
TexInfo currentTexInfo;
TexData currentTexData;
const char * texName;
char currentTexName[256];
int currentGeomIndex;
VBSPGeometry * currentGeom;
ref_ptr<Group> entityGroup;
ref_ptr<Group> geomGroup;
std::stringstream groupName;
// Create a list of VBSPGeometry objects for each texdata entry in the
// scene. These objects will hold the necessary geometry data until we
@@ -501,6 +502,10 @@ ref_ptr<Group> VBSPEntity::createBrushGeometry()
}
}
// Name the entity group
groupName << class_name << ":" << entity_model_index;
entityGroup->setName(groupName.str());
// Return the group we created
return entityGroup;
}
@@ -549,6 +554,9 @@ ref_ptr<Group> VBSPEntity::createModelGeometry()
// Add the model node to the group
entityGroup->addChild(modelNode.get());
// Set the group's name
entityGroup->setName(class_name + std::string(":") + entity_model);
}
else
{

View File

@@ -32,6 +32,7 @@ protected:
VBSPData * bsp_data;
EntityClass entity_class;
std::string class_name;
typedef std::pair<std::string, std::string> EntityParameter;
typedef std::map<std::string, std::string> EntityParameters;

View File

@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <osg/Geode>
#include <osgUtil/TriStripVisitor>
#include "VBSPGeometry.h"
@@ -647,6 +648,12 @@ ref_ptr<Group> VBSPGeometry::createGeometry()
// Add the geometry to the geode
geode->addDrawable(geometry.get());
// Now, stripify the geode to convert the POLYGON primitives to
// triangle strips
osgUtil::TriStripVisitor tsv;
geode->accept(tsv);
tsv.stripify();
}
// Now do the same for the displacement surfaces (if any)

View File

@@ -745,8 +745,10 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
std::string tex2Name;
ref_ptr<Texture> texture;
ref_ptr<Texture> texture2;
ref_ptr<Material> material;
ref_ptr<BlendFunc> blend;
bool translucent;
double alpha;
// Find the material file
mtlFileName = std::string(materialName) + ".vmt";
@@ -818,6 +820,9 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
// Assume no transparency unless the properties say otherwise
translucent = false;
// Assume fully opaque
alpha = 1.0;
// Read the material properties next
while (!mtlFile->eof())
{
@@ -858,6 +863,17 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
if ((token == "1") || (token == "true"))
translucent = true;
}
else if (equalCaseInsensitive(token, "$alpha"))
{
// Get the translucency setting
token = getToken(line, " \t\n\r\"", start);
// Interpret the setting
if (!token.empty())
{
alpha = atof(token.c_str());
}
}
// Try the next token
token = getToken(line, " \t\n\r\"", start);
@@ -873,6 +889,20 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
// This shader blends between two textures based on a per-vertex
// attribute. This is used for displaced terrain surfaces in HL2 maps.
stateSet = createBlendShader(texture.get(), texture2.get());
// Add a material to the state set
material = new Material();
material->setAmbient(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setDiffuse(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setSpecular(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setShininess(Material::FRONT_AND_BACK, 1.0);
material->setEmission(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setAlpha(Material::FRONT_AND_BACK, alpha);
stateSet->setAttributeAndModes(material.get(), StateAttribute::ON);
}
else if (equalCaseInsensitive(shaderName, "UnlitGeneric"))
{
@@ -916,6 +946,20 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
// Create the StateSet
stateSet = new StateSet();
// Add a material to the state set
material = new Material();
material->setAmbient(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setDiffuse(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setSpecular(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setShininess(Material::FRONT_AND_BACK, 1.0);
material->setEmission(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setAlpha(Material::FRONT_AND_BACK, alpha);
stateSet->setAttributeAndModes(material.get(), StateAttribute::ON);
// Add the texture attribute (or disable texturing if no base texture)
if (texture != NULL)
{
@@ -1081,8 +1125,13 @@ void VBSPReader::createScene()
// If we loaded the prop correctly, add it to the scene
if (propNode.valid())
{
// Add the model to the transform node, and attach the transform
// to the scene
propXform->addChild(propNode.get());
group->addChild(propXform.get());
// Name the prop
propXform->setName(std::string("prop_static:" + propModel));
}
else
{

View File

@@ -1932,21 +1932,21 @@ yyreduce:
case 114:
{
yyval.real = atof(flexer->YYText());
yyval.real = osg::asciiToFloat(flexer->YYText());
;}
break;
case 115:
{
yyval.real = atof(flexer->YYText());
yyval.real = osg::asciiToFloat(flexer->YYText());
;}
break;
case 116:
{
yyval.real = atof(flexer->YYText());
yyval.real = osg::asciiToFloat(flexer->YYText());
;}
break;

View File

@@ -1,7 +1,7 @@
IF (DCMTK_FOUND)
# note, we have to include a '/' in front of the directory string to prevent a CMake bug from ignoring the directory
INCLUDE_DIRECTORIES(/${DCMTK_ROOT_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${DCMTK_ROOT_INCLUDE_DIR})
SET(TARGET_SRC ReaderWriterDICOM.cpp )
@@ -15,23 +15,22 @@ ELSE(DCMTK_FOUND)
INCLUDE(${ITK_USE_FILE})
INCLUDE_DIRECTORIES( ITK_INCLUDE_DIRS )
SET(TARGET_SRC ReaderWriterDICOM.cpp )
LINK_DIRECTORIES(${ITK_LIBRARY_DIRS})
# LINK_LIBRARIES(${ITK_LIBRARIES})
LINK_LIBRARIES(ITKCommon ITKIO)
ADD_DEFINITIONS(-DUSE_ITK)
ADD_DEFINITIONS(-DVCL_CAN_STATIC_CONST_INIT_FLOAT=0)
ENDIF(ITK_FOUND)
ENDIF(DCMTK_FOUND)
SET(TARGET_ADDED_LIBRARIES osgVolume )
IF(CMAKE_COMPILER_IS_GNUCXX)
# Remove -pedantic flag as it barfs on ffmoeg headers
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
#### end var setup ###
SETUP_PLUGIN(dicom dicom)

View File

@@ -858,33 +858,33 @@ class ReaderWriterDW : public osgDB::ReaderWriter
} else if (strncmp(buff, "CurrPhase:",10)==0) {
} else if (strncmp(buff, "numPhases:",10)==0) {
} else if (strncmp(buff, "Opacity:",8)==0) {
float opacity=atof(buff+8);
float opacity=osg::asciiToFloat(buff+8);
matpalet[nmat].setopacity(opacity);
} else if (strncmp(buff, "FallOff:",8)==0) {
float fo=atof(buff+8);
float fo=osg::asciiToFloat(buff+8);
matpalet[nmat].setFallOff(fo);
} else if (strncmp(buff, "InnerHalfAngle:",15)==0) {
float ha=atof(buff+15);
float ha=osg::asciiToFloat(buff+15);
matpalet[nmat].setHalfAngleIn(ha);
} else if (strncmp(buff, "OuterHalfAngle:",15)==0) {
float ha=atof(buff+15);
float ha=osg::asciiToFloat(buff+15);
matpalet[nmat].setHalfAngleOut(ha);
} else if (strncmp(buff, "Brightness:",11)==0) {
float br=atof(buff+11);
float br=osg::asciiToFloat(buff+11);
matpalet[nmat].setBright(br);
} else if (strncmp(buff, "Attentuation:",13)==0) { // oops - they can't spell
matpalet[nmat].setAtten(buff+13);
} else if (strncmp(buff, "MaterialType:",13)==0) {
matpalet[nmat].setType(buff+14);
} else if (strncmp(buff, "SpecularReflectivity:",21)==0) {
float spec=atof(buff+21);
float spec=osg::asciiToFloat(buff+21);
matpalet[nmat].setspecular(spec);
} else if (strncmp(buff, "SmoothnessExponent:",19)==0) {
float spec=atof(buff+19);
float spec=osg::asciiToFloat(buff+19);
matpalet[nmat].setspecexp(spec*128.0f/100.0f); // convert to 0-128 range from percent
} else if (strncmp(buff, "TextureWidthAndHeight:",22)==0) {
char *ct=strchr(buff+22,',');
float repx=atof(buff+23), repy=atof(ct+1);
float repx=osg::asciiToFloat(buff+23), repy=osg::asciiToFloat(ct+1);
matpalet[nmat].settxrep(repx, repy);
} else if (strncmp(buff, "PictureFile:",12)==0) {
char *end=strchr(buff,'\n'); // end of line

View File

@@ -172,7 +172,7 @@ DataOutputStream::DataOutputStream(std::ostream * ostream, const osgDB::ReaderWr
if (numOfCharInNumber>0)
{
std::string numberString = optionsString.substr(endOfToken+1, numOfCharInNumber);
_maximumErrorToSizeRatio = atof(numberString.c_str());
_maximumErrorToSizeRatio = osg::asciiToDouble(numberString.c_str());
osg::notify(osg::DEBUG_INFO)<<"TerrainMaximumErrorToSizeRatio = "<<_maximumErrorToSizeRatio<<std::endl;
}

View File

@@ -619,12 +619,34 @@ int *numComponents_ret)
class ReaderWriterJPEG : public osgDB::ReaderWriter
{
WriteResult::WriteStatus write_JPEG_file (std::ostream &fout,int image_width,int image_height,JSAMPLE* image_buffer,int quality = 100) const
WriteResult::WriteStatus write_JPEG_file (std::ostream &fout, const osg::Image &img, int quality = 100) const
{
int image_width = img.s();
int image_height = img.t();
if ( (image_width == 0) || (image_height == 0) )
return WriteResult::ERROR_IN_WRITING_FILE;
J_COLOR_SPACE image_color_space = JCS_RGB;
int image_components = 3;
// Only cater for gray, alpha and RGB for now
switch(img.getPixelFormat()) {
case(GL_LUMINANCE):
case(GL_ALPHA): {
image_color_space = JCS_GRAYSCALE;
image_components = 1;
break;
}
case(GL_RGB): {
image_color_space = JCS_RGB;
image_components = 3;
break;
}
default: return WriteResult::ERROR_IN_WRITING_FILE; break;
}
JSAMPLE* image_buffer = (JSAMPLE*)(img.data());
/* This struct contains the JPEG compression parameters and pointers to
* working space (which is allocated as needed by the JPEG library).
* It is possible to have several such structures, representing multiple
@@ -680,8 +702,8 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
*/
cinfo.image_width = image_width; /* image width and height, in pixels */
cinfo.image_height = image_height;
cinfo.input_components = 3; /* # of color components per pixel */
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
cinfo.input_components = image_components; /* # of color components per pixel */
cinfo.in_color_space = image_color_space; /* colorspace of input image */
/* Now use the library's routine to set default compression parameters.
* (You must set at least cinfo.in_color_space before calling this,
* since the defaults depend on the source color space.)
@@ -707,7 +729,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
* To keep things simple, we pass one scanline per call; you can pass
* more if you wish, though.
*/
row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */
row_stride = image_width * image_components; /* JSAMPLEs per row in image_buffer */
while (cinfo.next_scanline < cinfo.image_height)
{
@@ -833,7 +855,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
{
osg::ref_ptr<osg::Image> tmp_img = new osg::Image(img);
tmp_img->flipVertical();
WriteResult::WriteStatus ws = write_JPEG_file(fout,img.s(),img.t(),(JSAMPLE*)(tmp_img->data()),getQuality(options));
WriteResult::WriteStatus ws = write_JPEG_file(fout, *(tmp_img.get()), getQuality(options));
return ws;
}

View File

@@ -191,8 +191,10 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
std::string tex2Name;
ref_ptr<Texture> texture;
ref_ptr<Texture> texture2;
ref_ptr<Material> material;
ref_ptr<BlendFunc> blend;
bool translucent;
double alpha;
// Find the material file
mtlFileName = std::string(materialName) + ".vmt";
@@ -298,6 +300,9 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
// Assume not translucent unless the properties say otherwise
translucent = false;
// Assume full opacity
alpha = 1.0;
// Read the material properties next
while (!mtlFile->eof())
{
@@ -341,6 +346,17 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
translucent = true;
}
}
else if (equalCaseInsensitive(token, "$alpha"))
{
// Get the translucency setting
token = getToken(line, " \t\n\r\"", start);
// Interpret the setting
if (!token.empty())
{
alpha = atof(token.c_str());
}
}
// Try the next token
token = getToken(line, " \t\n\r\"", start);
@@ -379,6 +395,7 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
blend = new BlendFunc(BlendFunc::SRC_ALPHA,
BlendFunc::ONE_MINUS_SRC_ALPHA);
stateSet->setAttributeAndModes(blend.get(), StateAttribute::ON);
stateSet->setMode(GL_BLEND, StateAttribute::ON);
// Set the rendering hint for this stateset to transparent
stateSet->setRenderingHint(StateSet::TRANSPARENT_BIN);
@@ -387,11 +404,24 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
else
{
// All other shaders fall back to fixed function
// TODO: LightMappedGeneric shader
// Create the StateSet
stateSet = new StateSet();
// Add a material to the state set
material = new Material();
material->setAmbient(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setDiffuse(Material::FRONT_AND_BACK,
Vec4(1.0, 1.0, 1.0, 1.0) );
material->setSpecular(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setShininess(Material::FRONT_AND_BACK, 1.0);
material->setEmission(Material::FRONT_AND_BACK,
Vec4(0.0, 0.0, 0.0, 1.0) );
material->setAlpha(Material::FRONT_AND_BACK, alpha);
stateSet->setAttributeAndModes(material.get(), StateAttribute::ON);
// Add the texture attribute (or disable texturing if no base texture)
if (texture != NULL)
{
@@ -399,13 +429,14 @@ ref_ptr<StateSet> MDLReader::readMaterialFile(std::string materialName)
StateAttribute::ON);
// See if the material is translucent
if (translucent)
if ((translucent) || (alpha < 1.0))
{
// Add the blending attribute as well
blend = new BlendFunc(BlendFunc::SRC_ALPHA,
BlendFunc::ONE_MINUS_SRC_ALPHA);
stateSet->setAttributeAndModes(blend.get(),
StateAttribute::ON);
stateSet->setMode(GL_BLEND, StateAttribute::ON);
// Set the rendering hint for this stateset to transparent
stateSet->setRenderingHint(StateSet::TRANSPARENT_BIN);
@@ -633,14 +664,15 @@ bool MDLReader::readFile(const std::string & file)
mdlRoot->addBodyPart(partNode);
}
// Open the VVD file that goes with this model
// Open the VVD (vertex data) file that goes with this model
vvdFile = findDataFile(getNameLessExtension(file) + ".vvd",
CASE_INSENSITIVE);
vvdReader = new VVDReader();
vvdReader->readFile(vvdFile);
// Open the VTX file that goes with this model (at this point, I don't
// see a reason not to always just use the DX9 version)
// Open the VTX file (index and primitive data) that goes with this model
// (at this point, I don't see a reason not to always just use the DX9
// version)
vtxFile = findDataFile(getNameLessExtension(file) + ".dx90.vtx",
CASE_INSENSITIVE);
vtxReader = new VTXReader(vvdReader, mdlRoot);

View File

@@ -8,8 +8,8 @@ Overview
This plugin allows .mdl files from games that make use of Valve's Source
engine (Half Life 2, etc) to be loaded by OSG.
I've tested this plugin with dozens of on several HL2 models, as well as some
3rd party models.
I've tested this plugin with dozens of HL2 models, as well as some 3rd party
models.
Using the Plugin

View File

@@ -58,7 +58,7 @@ class NormalsReader: public osgDB::ReaderWriter
std::string value = opt.substr(index+1);
if( key == "scale" || key == "SCALE" )
{
scale = atof( value.c_str() );
scale = osg::asciiToFloat( value.c_str() );
}
else if( key == "mode" || key == "MODE" )
{

View File

@@ -7,6 +7,9 @@
#include <osgDB/Input>
#include <osgDB/Output>
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#include <set>
#include <string.h>
@@ -65,6 +68,11 @@ void initGLNames()
{
static bool first_time = true;
if (!first_time) return;
static OpenThreads::Mutex s_initGLNames;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_initGLNames);
if (!first_time) return;
ADD_NAME("GL_ALPHA_TEST",GL_ALPHA_TEST)
ADD_NAME("GL_BLEND",GL_BLEND)

View File

@@ -539,14 +539,14 @@ bool ReaderWriterTXP::extractChildrenLocations(const std::string& name, int pare
token = strtok(0, "_");
if(!token)
break;
locs[idx].zmin = (float)atof(token);
locs[idx].zmin = osg::asciiToFloat(token);
nbTokenRead++;
// ZMAX
token = strtok(0, "_");
if(!token)
break;
locs[idx].zmax= (float)atof(token);
locs[idx].zmax = osg::asciiToFloat(token);
nbTokenRead++;
locs[idx].lod = parentLod+1;

View File

@@ -102,7 +102,7 @@ TXPParser::TXPParser():
if (getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY"))
{
_defaultMaxAnisotropy = atof(getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY"));
_defaultMaxAnisotropy = osg::asciiToFloat(getenv("OSG_TXP_DEFAULT_MAX_ANISOTROPY"));
}
}

View File

@@ -193,7 +193,7 @@ trpgllong trpg_byteswap_llong ( trpgllong number )
{
trpgllong result;
trpg_swap_sixteen ( (char *) &number, (char *) &result);
trpg_swap_eight ( (char *) &number, (char *) &result);
return result;
}

View File

@@ -323,7 +323,7 @@ float DirectionalSector::operator() (const osg::Vec3& eyeLocal) const
if ( EPyz[0] < _cosVertAngle ) {
// In the fade range
//fprintf(stderr, " >> inside el fade range\n") ;
elev_intensity = (_cosVertAngle-EPyz[0])/(_cosVertAngle-_cosVertFadeAngle) ;
elev_intensity = (EPyz[0]-_cosVertFadeAngle)/(_cosVertAngle-_cosVertFadeAngle) ;
} else {
// Fully in elevation range
elev_intensity = 1.0 ;
@@ -349,7 +349,7 @@ float DirectionalSector::operator() (const osg::Vec3& eyeLocal) const
if ( EPxy[1] < _cosHorizAngle ) {
// In fade range
//fprintf(stderr, " >> inside az fade range\n") ;
azim_intensity = (_cosHorizAngle-EPxy[1])/(_cosHorizAngle-_cosHorizFadeAngle) ;
azim_intensity = (EPxy[1]-_cosHorizFadeAngle)/(_cosHorizAngle-_cosHorizFadeAngle) ;
} else {
// Fully in azimuth range
//fprintf(stderr, " >> fully inside az range\n") ;

View File

@@ -147,7 +147,7 @@ void TextBase::setAlignment(AlignmentType alignment)
if (_alignment==alignment) return;
_alignment = alignment;
computePositions();
computeGlyphRepresentation();
}
void TextBase::setAxisAlignment(AxisAlignment axis)

View File

@@ -11,12 +11,18 @@
* OpenSceneGraph Public License for more details.
*/
#include <osgUtil/GLObjectsVisitor>
#include <osg/Drawable>
#include <osg/Notify>
#include <osg/Timer>
using namespace osg;
using namespace osgUtil;
namespace osgUtil
{
/////////////////////////////////////////////////////////////////
//
// GLObjectsVisitor
//
GLObjectsVisitor::GLObjectsVisitor(Mode mode)
{
setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
@@ -45,7 +51,7 @@ void GLObjectsVisitor::apply(osg::Geode& node)
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
Drawable* drawable = node.getDrawable(i);
osg::Drawable* drawable = node.getDrawable(i);
if (drawable)
{
apply(*drawable);
@@ -105,7 +111,12 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
stateset.compileGLObjects(*_renderInfo.getState());
osg::Program* program = dynamic_cast<osg::Program*>(stateset.getAttribute(osg::StateAttribute::PROGRAM));
if (program) _lastCompiledProgram = program;
if (program) {
if( program->isFixedFunction() )
_lastCompiledProgram = NULL; // It does not make sense to apply uniforms on fixed pipe
else
_lastCompiledProgram = program;
}
if (_lastCompiledProgram.valid() && !stateset.getUniformList().empty())
{
@@ -127,7 +138,7 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
}
else if(_renderInfo.getState()->getLastAppliedProgramObject()){
GL2Extensions* extensions = GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
}
@@ -145,6 +156,11 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
}
}
/////////////////////////////////////////////////////////////////
//
// GLObjectsVisitor
//
GLObjectsOperation::GLObjectsOperation(GLObjectsVisitor::Mode mode):
osg::GraphicsOperation("GLObjectOperation",false),
_mode(mode)
@@ -182,3 +198,6 @@ void GLObjectsOperation::operator () (osg::GraphicsContext* context)
}
// osg::notify(osg::NOTICE)<<"GLObjectsOperation::after >>>>>>>>>>> "<<std::endl;
}
} // end of namespace osgUtil

View File

@@ -1811,7 +1811,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode)
{
//geom->computeCorrectBindingsAndArraySizes();
if (!geometryContainsSharedArrays(*geom) && isOperationPermissibleForObject(geom))
if (!geometryContainsSharedArrays(*geom) &&
geom->getDataVariance()!=osg::Object::DYNAMIC &&
isOperationPermissibleForObject(geom))
{
geometryDuplicateMap[geom].push_back(geom);
}

View File

@@ -26,8 +26,8 @@
using namespace osg;
using namespace osgUtil;
class RenderBinPrototypeList : public osg::Referenced, public std::map< std::string, osg::ref_ptr<RenderBin> >
class RenderBinPrototypeList : osg::depends_on<OpenThreads::Mutex*, osg::Referenced::getGlobalReferencedMutex>,
public osg::Referenced, public std::map< std::string, osg::ref_ptr<RenderBin> >
{
public:
RenderBinPrototypeList() {}
@@ -83,8 +83,17 @@ void RenderBin::removeRenderBinPrototype(RenderBin* proto)
RenderBinPrototypeList* list = renderBinPrototypeList();
if (list && proto)
{
RenderBinPrototypeList::iterator itr = list->find(proto->className());
if (itr != list->end()) list->erase(itr);
for(RenderBinPrototypeList::iterator itr = list->begin();
itr != list->end();
++itr)
{
if (itr->second == proto)
{
// osg::notify(osg::NOTICE)<<"Found protype, now erasing "<<itr->first<<std::endl;
list->erase(itr);
return;
}
}
}
}

View File

@@ -1230,7 +1230,7 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
if (_clearMask & GL_STENCIL_BUFFER_BIT)
{
glClearStencil( _clearStencil);
glStencilMask ( GL_TRUE );
glStencilMask ( ~0u );
state.haveAppliedAttribute( osg::StateAttribute::STENCIL );
}

View File

@@ -348,6 +348,8 @@ void CompositeViewer::getCameras(Cameras& cameras, bool onlyActive)
void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid)
{
scenes.clear();
typedef std::set<osgViewer::Scene*> SceneSet;
SceneSet sceneSet;
@@ -369,6 +371,8 @@ void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid)
void CompositeViewer::getViews(Views& views, bool onlyValid)
{
views.clear();
for(RefViews::iterator vitr = _views.begin();
vitr != _views.end();
++vitr)
@@ -379,6 +383,8 @@ void CompositeViewer::getViews(Views& views, bool onlyValid)
void CompositeViewer::getAllThreads(Threads& threads, bool onlyActive)
{
threads.clear();
OperationThreads operationThreads;
getOperationThreads(operationThreads);

View File

@@ -18,6 +18,7 @@
#include <osgViewer/api/Win32/GraphicsWindowWin32>
#include <osgViewer/api/Win32/PixelBufferWin32>
#include <osgViewer/View>
#include <osg/DeleteHandler>
#include <osg/ApplicationUsage>
@@ -1265,6 +1266,21 @@ void GraphicsWindowWin32::destroyWindow( bool deleteNativeWindow )
{
if (_destroying) return;
_destroying = true;
if (_graphicsThread && _graphicsThread->isRunning())
{
// find all the viewers that might own use this graphics context
osg::GraphicsContext::Cameras cameras = getCameras();
for(osg::GraphicsContext::Cameras::iterator it=cameras.begin(); it!=cameras.end(); ++it)
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>((*it)->getView());
osgViewer::ViewerBase* viewerBase = view ? view->getViewerBase() : 0;
if (viewerBase && viewerBase->areThreadsRunning())
{
viewerBase->stopThreading();
}
}
}
if (_hdc)
{

View File

@@ -44,137 +44,184 @@ class X11KeyboardMap
X11KeyboardMap()
{
_keymap[XK_Escape ] = osgGA::GUIEventAdapter::KEY_Escape;
_keymap[XK_F1 ] = osgGA::GUIEventAdapter::KEY_F1;
_keymap[XK_F2 ] = osgGA::GUIEventAdapter::KEY_F2;
_keymap[XK_F3 ] = osgGA::GUIEventAdapter::KEY_F3;
_keymap[XK_F4 ] = osgGA::GUIEventAdapter::KEY_F4;
_keymap[XK_F5 ] = osgGA::GUIEventAdapter::KEY_F5;
_keymap[XK_F6 ] = osgGA::GUIEventAdapter::KEY_F6;
_keymap[XK_F7 ] = osgGA::GUIEventAdapter::KEY_F7;
_keymap[XK_F8 ] = osgGA::GUIEventAdapter::KEY_F8;
_keymap[XK_F9 ] = osgGA::GUIEventAdapter::KEY_F9;
_keymap[XK_F10 ] = osgGA::GUIEventAdapter::KEY_F10;
_keymap[XK_F11 ] = osgGA::GUIEventAdapter::KEY_F11;
_keymap[XK_F12 ] = osgGA::GUIEventAdapter::KEY_F12;
_keymap[XK_quoteleft ] = '"';
_keymap[XK_1 ] = '1';
_keymap[XK_2 ] = '2';
_keymap[XK_3 ] = '3';
_keymap[XK_4 ] = '4';
_keymap[XK_5 ] = '5';
_keymap[XK_6 ] = '6';
_keymap[XK_7 ] = '7';
_keymap[XK_8 ] = '8';
_keymap[XK_9 ] = '9';
_keymap[XK_0 ] = '0';
_keymap[XK_minus ] = '-';
_keymap[XK_equal ] = '=';
_keymap[XK_BackSpace ] = osgGA::GUIEventAdapter::KEY_BackSpace;
_keymap[XK_Tab ] = osgGA::GUIEventAdapter::KEY_Tab;
_keymap[XK_a ] = 'A';
_keymap[XK_b ] = 'B';
_keymap[XK_c ] = 'C';
_keymap[XK_d ] = 'D';
_keymap[XK_e ] = 'E';
_keymap[XK_f ] = 'F';
_keymap[XK_g ] = 'G';
_keymap[XK_h ] = 'H';
_keymap[XK_i ] = 'I';
_keymap[XK_j ] = 'J';
_keymap[XK_k ] = 'K';
_keymap[XK_l ] = 'L';
_keymap[XK_m ] = 'M';
_keymap[XK_n ] = 'N';
_keymap[XK_o ] = 'O';
_keymap[XK_p ] = 'P';
_keymap[XK_q ] = 'Q';
_keymap[XK_r ] = 'R';
_keymap[XK_s ] = 'S';
_keymap[XK_t ] = 'T';
_keymap[XK_u ] = 'U';
_keymap[XK_v ] = 'V';
_keymap[XK_w ] = 'W';
_keymap[XK_x ] = 'X';
_keymap[XK_y ] = 'Y';
_keymap[XK_z ] = 'Z';
_keymap[XK_bracketleft ] = '(';
_keymap[XK_bracketright ] = ')';
_keymap[XK_backslash ] = '\\';
_keymap[XK_Caps_Lock ] = osgGA::GUIEventAdapter::KEY_Caps_Lock;
_keymap[XK_semicolon ] = ';';
_keymap[XK_apostrophe ] = '\'';
_keymap[XK_Return ] = osgGA::GUIEventAdapter::KEY_Return;
_keymap[XK_comma ] = ',';
_keymap[XK_period ] = '.';
_keymap[XK_slash ] = '/';
_keymap[XK_space ] = ' ';
_keymap[XK_Shift_L ] = osgGA::GUIEventAdapter::KEY_Shift_L;
_keymap[XK_Shift_R ] = osgGA::GUIEventAdapter::KEY_Shift_R;
_keymap[XK_Control_L ] = osgGA::GUIEventAdapter::KEY_Control_L;
_keymap[XK_Control_R ] = osgGA::GUIEventAdapter::KEY_Control_R;
_keymap[XK_Meta_L ] = osgGA::GUIEventAdapter::KEY_Meta_L;
_keymap[XK_Meta_R ] = osgGA::GUIEventAdapter::KEY_Meta_R;
_keymap[XK_Alt_L ] = osgGA::GUIEventAdapter::KEY_Alt_L;
_keymap[XK_Alt_R ] = osgGA::GUIEventAdapter::KEY_Alt_R;
_keymap[XK_Super_L ] = osgGA::GUIEventAdapter::KEY_Super_L;
_keymap[XK_Super_R ] = osgGA::GUIEventAdapter::KEY_Super_R;
_keymap[XK_Hyper_L ] = osgGA::GUIEventAdapter::KEY_Hyper_L;
_keymap[XK_Hyper_R ] = osgGA::GUIEventAdapter::KEY_Hyper_R;
_keymap[XK_Menu ] = osgGA::GUIEventAdapter::KEY_Menu;
_keymap[XK_Print ] = osgGA::GUIEventAdapter::KEY_Print;
_keymap[XK_Scroll_Lock ] = osgGA::GUIEventAdapter::KEY_Scroll_Lock;
_keymap[XK_Pause ] = osgGA::GUIEventAdapter::KEY_Pause;
_keymap[XK_Home ] = osgGA::GUIEventAdapter::KEY_Home;
_keymap[XK_Page_Up ] = osgGA::GUIEventAdapter::KEY_Page_Up;
_keymap[XK_End ] = osgGA::GUIEventAdapter::KEY_End;
_keymap[XK_Page_Down ] = osgGA::GUIEventAdapter::KEY_Page_Down;
_keymap[XK_Delete ] = osgGA::GUIEventAdapter::KEY_Delete;
_keymap[XK_Insert ] = osgGA::GUIEventAdapter::KEY_Insert;
_keymap[XK_Left ] = osgGA::GUIEventAdapter::KEY_Left;
_keymap[XK_Up ] = osgGA::GUIEventAdapter::KEY_Up;
_keymap[XK_Right ] = osgGA::GUIEventAdapter::KEY_Right;
_keymap[XK_Down ] = osgGA::GUIEventAdapter::KEY_Down;
_keymap[XK_Num_Lock ] = osgGA::GUIEventAdapter::KEY_Num_Lock;
_keymap[XK_KP_Divide ] = osgGA::GUIEventAdapter::KEY_KP_Divide;
_keymap[XK_KP_Multiply ] = osgGA::GUIEventAdapter::KEY_KP_Multiply;
_keymap[XK_KP_Subtract ] = osgGA::GUIEventAdapter::KEY_KP_Subtract;
_keymap[XK_KP_Add ] = osgGA::GUIEventAdapter::KEY_KP_Add;
_keymap[XK_KP_Home ] = osgGA::GUIEventAdapter::KEY_KP_Home;
_keymap[XK_KP_Up ] = osgGA::GUIEventAdapter::KEY_KP_Up;
_keymap[XK_KP_Page_Up ] = osgGA::GUIEventAdapter::KEY_KP_Page_Up;
_keymap[XK_KP_Left ] = osgGA::GUIEventAdapter::KEY_KP_Left;
_keymap[XK_KP_Begin ] = osgGA::GUIEventAdapter::KEY_KP_Begin;
_keymap[XK_KP_Right ] = osgGA::GUIEventAdapter::KEY_KP_Right;
_keymap[XK_KP_End ] = osgGA::GUIEventAdapter::KEY_KP_End;
_keymap[XK_KP_Down ] = osgGA::GUIEventAdapter::KEY_KP_Down;
_keymap[XK_KP_Page_Down ] = osgGA::GUIEventAdapter::KEY_KP_Page_Down;
_keymap[XK_KP_Insert ] = osgGA::GUIEventAdapter::KEY_KP_Insert;
_keymap[XK_KP_Delete ] = osgGA::GUIEventAdapter::KEY_KP_Delete;
_keymap[XK_KP_Enter ] = osgGA::GUIEventAdapter::KEY_KP_Enter;
#if 0
_extendKeymap[8 ] = osgGA::GUIEventAdapter::KEY_BackSpace;
_extendKeymap[127 ] = osgGA::GUIEventAdapter::KEY_Delete;
_extendKeymap[27 ] = osgGA::GUIEventAdapter::KEY_Escape;
// _extendKeymap[13 ] = osgGA::GUIEventAdapter::KEY_Enter;
#endif
_extendedKeymap[XK_Escape ] = osgGA::GUIEventAdapter::KEY_Escape;
_extendedKeymap[XK_F1 ] = osgGA::GUIEventAdapter::KEY_F1;
_extendedKeymap[XK_F2 ] = osgGA::GUIEventAdapter::KEY_F2;
_extendedKeymap[XK_F3 ] = osgGA::GUIEventAdapter::KEY_F3;
_extendedKeymap[XK_F4 ] = osgGA::GUIEventAdapter::KEY_F4;
_extendedKeymap[XK_F5 ] = osgGA::GUIEventAdapter::KEY_F5;
_extendedKeymap[XK_F6 ] = osgGA::GUIEventAdapter::KEY_F6;
_extendedKeymap[XK_F7 ] = osgGA::GUIEventAdapter::KEY_F7;
_extendedKeymap[XK_F8 ] = osgGA::GUIEventAdapter::KEY_F8;
_extendedKeymap[XK_F9 ] = osgGA::GUIEventAdapter::KEY_F9;
_extendedKeymap[XK_F10 ] = osgGA::GUIEventAdapter::KEY_F10;
_extendedKeymap[XK_F11 ] = osgGA::GUIEventAdapter::KEY_F11;
_extendedKeymap[XK_F12 ] = osgGA::GUIEventAdapter::KEY_F12;
_extendedKeymap[XK_quoteleft ] = '`';
_extendedKeymap[XK_minus ] = '-';
_extendedKeymap[XK_equal ] = '=';
_extendedKeymap[XK_BackSpace ] = osgGA::GUIEventAdapter::KEY_BackSpace;
_extendedKeymap[XK_Tab ] = osgGA::GUIEventAdapter::KEY_Tab;
_extendedKeymap[XK_bracketleft ] = '(';
_extendedKeymap[XK_bracketright ] = ')';
_extendedKeymap[XK_backslash ] = '\\';
_extendedKeymap[XK_Caps_Lock ] = osgGA::GUIEventAdapter::KEY_Caps_Lock;
_extendedKeymap[XK_semicolon ] = ';';
_extendedKeymap[XK_apostrophe ] = '\'';
_extendedKeymap[XK_Return ] = osgGA::GUIEventAdapter::KEY_Return;
_extendedKeymap[XK_comma ] = ',';
_extendedKeymap[XK_period ] = '.';
_extendedKeymap[XK_slash ] = '/';
_extendedKeymap[XK_space ] = ' ';
_extendedKeymap[XK_Shift_L ] = osgGA::GUIEventAdapter::KEY_Shift_L;
_extendedKeymap[XK_Shift_R ] = osgGA::GUIEventAdapter::KEY_Shift_R;
_extendedKeymap[XK_Control_L ] = osgGA::GUIEventAdapter::KEY_Control_L;
_extendedKeymap[XK_Control_R ] = osgGA::GUIEventAdapter::KEY_Control_R;
_extendedKeymap[XK_Meta_L ] = osgGA::GUIEventAdapter::KEY_Meta_L;
_extendedKeymap[XK_Meta_R ] = osgGA::GUIEventAdapter::KEY_Meta_R;
_extendedKeymap[XK_Alt_L ] = osgGA::GUIEventAdapter::KEY_Alt_L;
_extendedKeymap[XK_Alt_R ] = osgGA::GUIEventAdapter::KEY_Alt_R;
_extendedKeymap[XK_Super_L ] = osgGA::GUIEventAdapter::KEY_Super_L;
_extendedKeymap[XK_Super_R ] = osgGA::GUIEventAdapter::KEY_Super_R;
_extendedKeymap[XK_Hyper_L ] = osgGA::GUIEventAdapter::KEY_Hyper_L;
_extendedKeymap[XK_Hyper_R ] = osgGA::GUIEventAdapter::KEY_Hyper_R;
_extendedKeymap[XK_Menu ] = osgGA::GUIEventAdapter::KEY_Menu;
_extendedKeymap[XK_Print ] = osgGA::GUIEventAdapter::KEY_Print;
_extendedKeymap[XK_Scroll_Lock ] = osgGA::GUIEventAdapter::KEY_Scroll_Lock;
_extendedKeymap[XK_Pause ] = osgGA::GUIEventAdapter::KEY_Pause;
_extendedKeymap[XK_Home ] = osgGA::GUIEventAdapter::KEY_Home;
_extendedKeymap[XK_Page_Up ] = osgGA::GUIEventAdapter::KEY_Page_Up;
_extendedKeymap[XK_End ] = osgGA::GUIEventAdapter::KEY_End;
_extendedKeymap[XK_Page_Down ] = osgGA::GUIEventAdapter::KEY_Page_Down;
_extendedKeymap[XK_Delete ] = osgGA::GUIEventAdapter::KEY_Delete;
_extendedKeymap[XK_Insert ] = osgGA::GUIEventAdapter::KEY_Insert;
_extendedKeymap[XK_Left ] = osgGA::GUIEventAdapter::KEY_Left;
_extendedKeymap[XK_Up ] = osgGA::GUIEventAdapter::KEY_Up;
_extendedKeymap[XK_Right ] = osgGA::GUIEventAdapter::KEY_Right;
_extendedKeymap[XK_Down ] = osgGA::GUIEventAdapter::KEY_Down;
_extendedKeymap[XK_Num_Lock ] = osgGA::GUIEventAdapter::KEY_Num_Lock;
_extendedKeymap[XK_KP_Divide ] = osgGA::GUIEventAdapter::KEY_KP_Divide;
_extendedKeymap[XK_KP_Multiply ] = osgGA::GUIEventAdapter::KEY_KP_Multiply;
_extendedKeymap[XK_KP_Subtract ] = osgGA::GUIEventAdapter::KEY_KP_Subtract;
_extendedKeymap[XK_KP_Add ] = osgGA::GUIEventAdapter::KEY_KP_Add;
_extendedKeymap[XK_KP_Home ] = osgGA::GUIEventAdapter::KEY_KP_Home;
_extendedKeymap[XK_KP_Up ] = osgGA::GUIEventAdapter::KEY_KP_Up;
_extendedKeymap[XK_KP_Page_Up ] = osgGA::GUIEventAdapter::KEY_KP_Page_Up;
_extendedKeymap[XK_KP_Left ] = osgGA::GUIEventAdapter::KEY_KP_Left;
_extendedKeymap[XK_KP_Begin ] = osgGA::GUIEventAdapter::KEY_KP_Begin;
_extendedKeymap[XK_KP_Right ] = osgGA::GUIEventAdapter::KEY_KP_Right;
_extendedKeymap[XK_KP_End ] = osgGA::GUIEventAdapter::KEY_KP_End;
_extendedKeymap[XK_KP_Down ] = osgGA::GUIEventAdapter::KEY_KP_Down;
_extendedKeymap[XK_KP_Page_Down ] = osgGA::GUIEventAdapter::KEY_KP_Page_Down;
_extendedKeymap[XK_KP_Insert ] = osgGA::GUIEventAdapter::KEY_KP_Insert;
_extendedKeymap[XK_KP_Delete ] = osgGA::GUIEventAdapter::KEY_KP_Delete;
_extendedKeymap[XK_KP_Enter ] = osgGA::GUIEventAdapter::KEY_KP_Enter;
_standardKeymap[XK_1 ] = '1';
_standardKeymap[XK_2 ] = '2';
_standardKeymap[XK_3 ] = '3';
_standardKeymap[XK_4 ] = '4';
_standardKeymap[XK_5 ] = '5';
_standardKeymap[XK_6 ] = '6';
_standardKeymap[XK_7 ] = '7';
_standardKeymap[XK_8 ] = '8';
_standardKeymap[XK_9 ] = '9';
_standardKeymap[XK_0 ] = '0';
_standardKeymap[XK_A ] = 'A';
_standardKeymap[XK_B ] = 'B';
_standardKeymap[XK_C ] = 'C';
_standardKeymap[XK_D ] = 'D';
_standardKeymap[XK_E ] = 'E';
_standardKeymap[XK_F ] = 'F';
_standardKeymap[XK_G ] = 'G';
_standardKeymap[XK_H ] = 'H';
_standardKeymap[XK_I ] = 'I';
_standardKeymap[XK_J ] = 'J';
_standardKeymap[XK_K ] = 'K';
_standardKeymap[XK_L ] = 'L';
_standardKeymap[XK_M ] = 'M';
_standardKeymap[XK_N ] = 'N';
_standardKeymap[XK_O ] = 'O';
_standardKeymap[XK_P ] = 'P';
_standardKeymap[XK_Q ] = 'Q';
_standardKeymap[XK_R ] = 'R';
_standardKeymap[XK_S ] = 'S';
_standardKeymap[XK_T ] = 'T';
_standardKeymap[XK_U ] = 'U';
_standardKeymap[XK_V ] = 'V';
_standardKeymap[XK_W ] = 'W';
_standardKeymap[XK_X ] = 'X';
_standardKeymap[XK_Y ] = 'Y';
_standardKeymap[XK_Z ] = 'Z';
_standardKeymap[XK_a ] = 'a';
_standardKeymap[XK_b ] = 'b';
_standardKeymap[XK_c ] = 'c';
_standardKeymap[XK_d ] = 'd';
_standardKeymap[XK_e ] = 'e';
_standardKeymap[XK_f ] = 'f';
_standardKeymap[XK_g ] = 'g';
_standardKeymap[XK_h ] = 'h';
_standardKeymap[XK_i ] = 'i';
_standardKeymap[XK_j ] = 'j';
_standardKeymap[XK_k ] = 'k';
_standardKeymap[XK_l ] = 'l';
_standardKeymap[XK_m ] = 'm';
_standardKeymap[XK_n ] = 'n';
_standardKeymap[XK_o ] = 'o';
_standardKeymap[XK_p ] = 'p';
_standardKeymap[XK_q ] = 'q';
_standardKeymap[XK_r ] = 'r';
_standardKeymap[XK_s ] = 's';
_standardKeymap[XK_t ] = 't';
_standardKeymap[XK_u ] = 'u';
_standardKeymap[XK_v ] = 'v';
_standardKeymap[XK_w ] = 'w';
_standardKeymap[XK_x ] = 'x';
_standardKeymap[XK_y ] = 'y';
_standardKeymap[XK_z ] = 'z';
}
~X11KeyboardMap() {}
int remapKey(int key)
{
KeyMap::iterator itr = _keymap.find(key);
if (itr == _keymap.end()) return key;
else return itr->second;
KeyMap::iterator itr = _extendedKeymap.find(key);
if (itr != _extendedKeymap.end()) return itr->second;
itr = _standardKeymap.find(key);
if (itr != _standardKeymap.end()) return itr->second;
return key;
}
bool remapExtendedKey(int& key)
{
KeyMap::iterator itr = _extendedKeymap.find(key);
if (itr != _extendedKeymap.end())
{
key = itr->second;
return true;
}
else return false;
}
protected:
typedef std::map<int, int> KeyMap;
KeyMap _keymap;
KeyMap _extendedKeymap;
KeyMap _standardKeymap;
};
static int remapX11Key(int key)
static bool remapExtendedX11Key(int& key)
{
static X11KeyboardMap s_x11KeyboardMap;
return s_x11KeyboardMap.remapKey(key);
return s_x11KeyboardMap.remapExtendedKey(key);
}
// Functions to handle key maps of type char[32] as contained in
@@ -1304,22 +1351,15 @@ void GraphicsWindowX11::transformMouseXY(float& x, float& y)
void GraphicsWindowX11::adaptKey(XKeyEvent& keyevent, int& keySymbol)
{
Display* display = _eventDisplay;
unsigned char keybuf[32];
XLookupString( &keyevent, (char *)keybuf, sizeof(keybuf), NULL, NULL );
unsigned char buffer_return[32];
int bytes_buffer = 32;
KeySym keysym_return;
KeySym ks = XKeycodeToKeysym( display, keyevent.keycode, 0 );
int remappedKey = remapX11Key(ks);
if (remappedKey & 0xff00)
int numChars = XLookupString(&keyevent, reinterpret_cast<char*>(buffer_return), bytes_buffer, &keysym_return, NULL);
keySymbol = keysym_return;
if (!remapExtendedX11Key(keySymbol) && (numChars==1))
{
// special keyboard character
keySymbol = remappedKey;
}
else
{
// normal ascii key
keySymbol = keybuf[0];
keySymbol = buffer_return[0];
}
}
@@ -1391,6 +1431,8 @@ void GraphicsWindowX11::rescanModifierMapping()
break;
}
}
XFree(mkm->modifiermap);
XFree(mkm);
}
void GraphicsWindowX11::flushKeyEvents()
@@ -1410,6 +1452,8 @@ void GraphicsWindowX11::getModifierMap(char* keymap) const
{
if (*m) keyMapSetKey(keymap, *m);
}
XFree(mkm->modifiermap);
XFree(mkm);
}
int GraphicsWindowX11::getModifierMask() const
@@ -1424,6 +1468,8 @@ int GraphicsWindowX11::getModifierMask() const
mask |= 1 << (i / mkm->max_keypermod);
}
}
XFree(mkm->modifiermap);
XFree(mkm);
return mask;
}

View File

@@ -939,16 +939,20 @@ void Viewer::updateTraversal()
void Viewer::getScenes(Scenes& scenes, bool onlyValid)
{
scenes.clear();
scenes.push_back(_scene.get());
}
void Viewer::getViews(Views& views, bool onlyValid)
{
views.clear();
views.push_back(this);
}
void Viewer::getAllThreads(Threads& threads, bool onlyActive)
{
threads.clear();
OperationThreads operationThreads;
getOperationThreads(operationThreads);

View File

@@ -389,7 +389,7 @@ RecordCameraPathHandler::RecordCameraPathHandler(const std::string& filename, fl
const char* str = getenv("OSG_RECORD_CAMERA_PATH_FPS");
if (str)
{
_interval = 1.0f / atof(str);
_interval = 1.0f / osg::asciiToDouble(str);
}
else
{

View File

@@ -316,9 +316,9 @@ void Window::update() {
// We only honor ANCHOR requests on topmost Windows, not embedded ones.
if((_vAnchor != VA_NONE || _hAnchor != HA_NONE) && !_parent && _wm) {
if(_vAnchor == VA_TOP) y = 0.0f;
if(_vAnchor == VA_TOP) y = _wm->getHeight() - _height.current;
else if(_vAnchor == VA_CENTER) y = osg::round(_wm->getHeight() / 2.0f);
else if(_vAnchor == VA_BOTTOM) y = _wm->getHeight() - _height.current;
else if(_vAnchor == VA_BOTTOM) y = 0.0f;
if(_hAnchor == HA_LEFT) x = 0.0f;
else if(_hAnchor == HA_CENTER) x = osg::round(_wm->getWidth() / 2.0f);