Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions OSGConfigured.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#cmakedefine OSG_ENABLE_MEMORY_DEBUGGING 1

#cmakedefine OSG_ENABLE_DOUBLE_MATRIX_STACK 1

#cmakedefine OSG_WITH_GDAL 1

/* Do not use GL subdir for glut */
Expand Down
3 changes: 1 addition & 2 deletions Source/Base/Base/OSGBaseFunctions.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2697,9 +2697,8 @@ OSG::Int32 putenv(Char8 *string)
inline
Char8 *getenv(const Char8 *string)
{
return NULL;
return ::getenv(string);
}
#else
#endif

/*! Pause program execution for the given number of milliseconds.
Expand Down
42 changes: 21 additions & 21 deletions Source/Base/Base/OSGColor.inl
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ UInt32 Color3<ValueTypeT>::minPart(const ValueType *rgbP)
template <class ValueTypeT> inline
Color3<ValueTypeT>::Color3(void)
{
setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
this->setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
}


Expand All @@ -243,7 +243,7 @@ Color3<ValueTypeT>::Color3(const ValueType red,
const ValueType green,
const ValueType blue)
{
setValues(red, green, blue);
this->setValues(red, green, blue);
}


Expand All @@ -255,9 +255,9 @@ Color3<ValueTypeT>::~Color3(void)
template <class ValueTypeT> inline
void Color3<ValueTypeT>::clear(void)
{
setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
this->setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
}


Expand All @@ -266,7 +266,7 @@ void Color3<ValueTypeT>::setValuesRGB(const ValueType red,
const ValueType green,
const ValueType blue)
{
setValues(red, green, blue);
this->setValues(red, green, blue);
}


Expand All @@ -284,9 +284,9 @@ void Color3<ValueTypeT>::setRandom(void)
{
Real32 rf = 1.0 / Real32(RAND_MAX);

setValuesRGB(TypeTraits<ValueTypeT>::getPortion(rf * rand()),
TypeTraits<ValueTypeT>::getPortion(rf * rand()),
TypeTraits<ValueTypeT>::getPortion(rf * rand()));
this->setValuesRGB(TypeTraits<ValueTypeT>::getPortion(rf * rand()),
TypeTraits<ValueTypeT>::getPortion(rf * rand()),
TypeTraits<ValueTypeT>::getPortion(rf * rand()));
}

/*! method to set the rgb values (BBGGRR)
Expand Down Expand Up @@ -399,10 +399,10 @@ const Color4<ValueTypeT> Color4<ValueTypeT>::Null;
template <class ValueTypeT> inline
Color4<ValueTypeT>::Color4(void)
{
setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
this->setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
}


Expand All @@ -420,7 +420,7 @@ Color4<ValueTypeT>::Color4(const ValueType red,
const ValueType blue,
const ValueType alpha)
{
setValues(red, green, blue, alpha);
this->setValues(red, green, blue, alpha);
}


Expand All @@ -432,10 +432,10 @@ Color4<ValueTypeT>::~Color4(void)
template <class ValueTypeT> inline
void Color4<ValueTypeT>::clear(void)
{
setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
this->setValues(TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement(),
TypeTraits<ValueTypeT>::getZeroElement());
}


Expand All @@ -445,7 +445,7 @@ void Color4<ValueTypeT>::setValuesRGBA(const ValueType red,
const ValueType blue,
const ValueType alpha)
{
setValues(red, green, blue, alpha);
this->setValues(red, green, blue, alpha);
}

template <class ValueTypeT> inline
Expand Down
2 changes: 1 addition & 1 deletion Source/Base/Base/OSGConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@

# define OSG_TMPL_STATIC_MEMBER_NEEDS_CLASS_INSTANTIATION

# define OSG_STATIC_MEMEBER_NEEDS_COPY_ASIGN_INIT
//# define OSG_STATIC_MEMEBER_NEEDS_COPY_ASIGN_INIT

# define OSG_MICROSOFT_DOTNET_COMPILER_HACKS

Expand Down
23 changes: 21 additions & 2 deletions Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include "OSGFieldContainer.h"
#include "OSGContainerPtrFuncs.h"
#include "OSGNameAttachment.h"

#include <algorithm>
#include <cctype>
Expand Down Expand Up @@ -272,7 +273,7 @@ void FieldContainer::registerChangedContainer(void)
_pContainerChanges, _bvChanged);
#endif

// osgSpinLock(&_uiContainerId, SpinLockBit);
osgSpinLock(&_uiContainerId, SpinLockBit);

if(_pContainerChanges == NULL)
{
Expand All @@ -283,10 +284,28 @@ void FieldContainer::registerChangedContainer(void)
_pContainerChanges->uiContainerId = this->getId();
_pContainerChanges->bvUncommittedChanges = &_bvChanged;
}
else
{
if(_pContainerChanges->pList != Thread::getCurrentChangeList())
{
std::string name("Unknown Name");
AttachmentContainer* attachment_container(dynamic_cast<AttachmentContainer*>(this));
if (NULL != attachment_container)
{
const Char8* temp_name(OSG::getName(attachment_container));
if (NULL != temp_name)
{
name = temp_name;
}
}
SWARNING << "Unsafe change from multiple threads for FieldContainer ["
<< getType().getCName() << "]: " << name << std::endl;
}
}

Thread::getCurrentChangeList()->addUncommited(_pContainerChanges);

// osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}

void FieldContainer::registerChangedContainerV(void)
Expand Down
6 changes: 6 additions & 0 deletions Source/Base/FieldContainer/Base/OSGFieldContainer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,16 @@ FieldContainer::~FieldContainer(void)
_pFieldFlags = NULL;
}

osgSpinLock(&_uiContainerId, SpinLockBit);

if(_pContainerChanges != NULL)
{
_pContainerChanges->release();

_pContainerChanges = NULL;
}

osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}

inline
Expand Down Expand Up @@ -382,11 +386,13 @@ void FieldContainer::editMField(ConstFieldMaskArg whichField,
inline
void FieldContainer::clearUncommited(ConstFieldMaskArg whichField)
{
osgSpinLock(&_uiContainerId, SpinLockBit);
if(_pContainerChanges != NULL)
{
_pContainerChanges->whichField |= whichField;
*(_pContainerChanges->bvUncommittedChanges) &= ~whichField;
}
osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}

#ifdef OSG_MT_CPTR_ASPECT
Expand Down
6 changes: 4 additions & 2 deletions Source/Base/FieldContainer/Base/OSGReflexiveContainer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ void ReflexiveContainer::onDestroyAspect(UInt32,
inline
void ReflexiveContainer::execEndEdit(ConstFieldMaskArg whichField)
{
osgSpinLock(&_uiContainerId, SpinLockBit);
_pContainerChanges->whichField |= whichField;
osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}

#if 0
Expand All @@ -147,15 +149,15 @@ ContainerChangeEntry *ReflexiveContainer::getChangeEntry(void)
inline
void ReflexiveContainer::clearChangeEntry(ContainerChangeEntry *pRef)
{
// osgSpinLock(&_uiContainerId, SpinLockBit);
osgSpinLock(&_uiContainerId, SpinLockBit);

if(_pContainerChanges == pRef)
{
_pContainerChanges = NULL;
_bvChanged = 0x0000;
}

// osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}

inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ typename DynFieldAttachment<AttachmentDescT>::ObjCPtr
{
ObjCPtr returnValue;

newAspectCopy(returnValue,
dynamic_cast<const Self *>(pRefAspect),
dynamic_cast<const Self *>(this));
this->newAspectCopy(returnValue,
dynamic_cast<const Self *>(pRefAspect),
dynamic_cast<const Self *>(this));

return returnValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ FieldContainer *LimitedCounterImpl<Desc>::createAspectCopy(
{
Self *returnValue;

newAspectCopy(returnValue,
dynamic_cast<const Self *>(pRefAspect),
dynamic_cast<const Self *>(this));
this->newAspectCopy(returnValue,
dynamic_cast<const Self *>(pRefAspect),
dynamic_cast<const Self *>(this));

return returnValue;
}
Expand Down
3 changes: 2 additions & 1 deletion Source/System/Action/RenderAction/OSGRenderPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ class OSG_SYSTEM_DLLMAPPING RenderPartition : public RenderPartitionBase
const Matrix &topMatrix ( void );

const Matrix &getModelMatrix ( void ) const;
const Matrix &getModelViewMatrix( void ) const;

const MatrixStore::second_type &getModelViewMatrix( void ) const;

const MatrixStore &getMatrixStackTop ( void ) const;

Expand Down
4 changes: 2 additions & 2 deletions Source/System/Action/RenderAction/OSGRenderPartition.inl
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ const Matrix &RenderPartition::getModelMatrix(void) const
return _modelMatrix;
}

inline
const Matrix &RenderPartition::getModelViewMatrix(void) const
inline const RenderPartition::MatrixStore::second_type &
RenderPartition::getModelViewMatrix(void) const
{
return _modelViewMatrix.second;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/System/FileIO/Base/OSGZStream.inl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ basic_zip_streambuf<charT, traits>::overflow(int_type c)
}
if (zip_to_stream(this->pbase(), w))
{
setp(this->pbase(), this->epptr() - 1);
this->setp(this->pbase(), this->epptr() - 1);
return c;
}
else
Expand Down
12 changes: 8 additions & 4 deletions Source/System/FileIO/Collada/OSGColladaEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,16 @@ ColladaEffect::readProfileCommon(domProfile_COMMON *prof)
}

readImageArray(prof->getImage_array());
readNewParams(prof->getNewparam_array());

const domCommon_newparam_type_Array &newParams = prof->getNewparam_array();
domProfile_COMMON::domTechniqueRef tech = prof->getTechnique();
readNewParams(tech->getNewparam_array());
readImageArray(tech->getImage_array());
}

void
ColladaEffect::readNewParams(const domCommon_newparam_type_Array& newParams)
{
for(UInt32 i = 0; i < newParams.getCount(); ++i)
{
// must read surface params before sampler params, because their <source>
Expand Down Expand Up @@ -326,9 +333,6 @@ ColladaEffect::readProfileCommon(domProfile_COMMON *prof)
<< std::endl;
}

domProfile_COMMON::domTechniqueRef tech = prof->getTechnique();

readImageArray(tech->getImage_array());
}

void
Expand Down
1 change: 1 addition & 0 deletions Source/System/FileIO/Collada/OSGColladaEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class OSG_FILEIO_DLLMAPPING ColladaEffect : public ColladaInstantiableElement
virtual void readProfileCommon(domProfile_COMMON *prof);
virtual void readProfileGLSL (domProfile_GLSL *prof);
virtual void readProfileCG (domProfile_CG *prof);
virtual void readNewParams (const domCommon_newparam_type_Array& newParams);

virtual MaterialTransitPtr createInstanceProfileCommon(
domProfile_COMMON *prof, domEffect *effect,
Expand Down
28 changes: 28 additions & 0 deletions Source/System/FileIO/Collada/OSGColladaGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,34 @@ ColladaGeometry::handleBindMaterial(
}
}

// Clean up the texcood property indices by ensuring that if we have at
// least one texture coordinate property, that it is assigned to the first
// texture coordinate slot. This should be a safe assumption since we are
// in the common profile.
GeoVectorProperty* tex_coord0(geo->getProperty(Geometry::TexCoordsIndex));
if (NULL == tex_coord0)
{

for (UInt16 idx = Geometry::TexCoords1Index; idx <= Geometry::TexCoords7Index; ++idx)
{
GeoVectorProperty* tex_coord(geo->getProperty(idx));
if (NULL != tex_coord)
{
OSG_COLLADA_LOG(("ColladaGeometry::handleBindMaterial: "
"Manual switch texture coords from [%d] to [%s].\n",
idx, Geometry::TexCoords1Index));

geo->setProperty(tex_coord, Geometry::TexCoordsIndex);
geo->setProperty(NULL, idx);

GeoIntegralProperty* index(geo->getIndex(idx));
geo->setIndex(index, Geometry::TexCoordsIndex);
geo->setIndex(NULL, idx);
break;
}
}
}

if(material != NULL)
{
geo->setMaterial(material);
Expand Down
6 changes: 3 additions & 3 deletions Source/System/Image/FileIO/OSGGDALImageFileType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
#include "OSGGeoReferenceAttachment.h"

#ifdef OSG_WITH_GDAL
#include "gdal/gdal_priv.h"
#include "gdal/ogr_srs_api.h"
#include "gdal/cpl_multiproc.h"
#include "gdal_priv.h"
#include "ogr_srs_api.h"
#include "cpl_multiproc.h"
#endif


Expand Down
4 changes: 2 additions & 2 deletions Source/System/Image/FileIO/OSGGDALImageFileType.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
#include "boost/shared_ptr.hpp"

#ifdef OSG_WITH_GDAL
#include "gdal/gdal_priv.h"
#include "gdal/ogr_srs_api.h"
#include "gdal_priv.h"
#include "ogr_srs_api.h"
#endif

OSG_BEGIN_NAMESPACE
Expand Down
Loading