Browse files

From Colin McDonald, build fixes for Solaris.

  • Loading branch information...
1 parent e3c45f9 commit 15ca8b1cbf8e87b97155eb99863212b45895d7bd @osg-training-guest osg-training-guest committed Jan 8, 2008
View
1 CMakeModules/FindFreeType.cmake
@@ -25,6 +25,7 @@
# I'm going to attempt to cut out the middleman and hope
# everything still works.
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
+ PATHS
$ENV{FREETYPE_DIR}
NO_DEFAULT_PATH
PATH_SUFFIXES include
View
39 include/osgDB/DatabasePager
@@ -339,12 +339,12 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
// Is texture compiled for all active contexts?
inline bool isCompiled(osg::Texture* texture) const
{
- using namespace std;
- return (count_if(_activeGraphicsContexts.begin(),
- _activeGraphicsContexts.end(),
- bind1st(mem_fun(&osg::Texture::getTextureObject),
- texture))
- == (int)_activeGraphicsContexts.size());
+ for (ActiveGraphicsContexts::iterator iter=_activeGraphicsContexts.begin();
+ iter!=_activeGraphicsContexts.end(); ++iter )
+ {
+ if ( texture->getTextureObject(*iter) == NULL ) return false;
+ }
+ return true;
}
inline static bool isCompiled(const osg::StateSet* stateSet,
@@ -364,20 +364,20 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
inline bool isCompiled(osg::StateSet* stateSet)
{
- using namespace std;
for (unsigned i = 0;
i < stateSet->getTextureAttributeList().size();
++i)
{
osg::Texture* texture
= dynamic_cast<osg::Texture*>(stateSet->getTextureAttribute(i,osg::StateAttribute::TEXTURE));
- if (texture
- && (count_if(_activeGraphicsContexts.begin(),
- _activeGraphicsContexts.end(),
- bind1st(mem_fun(&osg::Texture::getTextureObject),
- texture))
- != (int)_activeGraphicsContexts.size()))
- return false;
+ if (texture)
+ {
+ for (ActiveGraphicsContexts::iterator iter=_activeGraphicsContexts.begin();
+ iter!=_activeGraphicsContexts.end(); ++iter )
+ {
+ if ( texture->getTextureObject(*iter) == NULL ) return false;
+ }
+ }
}
return true;
}
@@ -395,14 +395,13 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
inline bool isCompiled(const osg::Drawable* drawable) const
{
- using namespace std;
if (drawable->getUseDisplayList())
{
- return (count_if(_activeGraphicsContexts.begin(),
- _activeGraphicsContexts.end(),
- bind1st(mem_fun(&osg::Drawable::getDisplayList),
- drawable))
- == (int)_activeGraphicsContexts.size());
+ for (ActiveGraphicsContexts::iterator iter=_activeGraphicsContexts.begin();
+ iter!=_activeGraphicsContexts.end(); ++iter )
+ {
+ if ( drawable->getDisplayList(*iter) == 0 ) return false;
+ }
}
return true;
}
View
2 src/osg/Geometry.cpp
@@ -2630,7 +2630,7 @@ void Geometry::accept(PrimitiveIndexFunctor& functor) const
return;
}
-unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom)
+static unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom)
{
unsigned int totalNumberOfPrimitives = 0;
View
32 src/osg/GraphicsContext.cpp
@@ -35,32 +35,44 @@
using namespace osg;
/////////////////////////////////////////////////////////////////////////////
-//
-// GraphicsContext static method implementations
-//
-static ref_ptr<GraphicsContext::WindowingSystemInterface> s_WindowingSystemInterface;
+
+// Use a static reference pointer to hold the window system interface.
+// Wrap this within a function, in order to control the order in which
+// the static pointer's constructor is executed.
+
+static ref_ptr<GraphicsContext::WindowingSystemInterface> &windowingSystemInterfaceRef()
+{
+ static ref_ptr<GraphicsContext::WindowingSystemInterface> s_WindowingSystemInterface;
+ return s_WindowingSystemInterface;
+}
+
+
+// GraphicsContext static method implementations
void GraphicsContext::setWindowingSystemInterface(WindowingSystemInterface* callback)
{
- s_WindowingSystemInterface = callback;
- osg::notify(osg::INFO)<<"GraphicsContext::setWindowingSystemInterface() "<<s_WindowingSystemInterface.get()<<"\t"<<&s_WindowingSystemInterface<<std::endl;
+ ref_ptr<GraphicsContext::WindowingSystemInterface> &wsref = windowingSystemInterfaceRef();
+ wsref = callback;
+ osg::notify(osg::INFO)<<"GraphicsContext::setWindowingSystemInterface() "<<wsref.get()<<"\t"<<&wsref<<std::endl;
}
GraphicsContext::WindowingSystemInterface* GraphicsContext::getWindowingSystemInterface()
{
- osg::notify(osg::INFO)<<"GraphicsContext::getWindowingSystemInterface() "<<s_WindowingSystemInterface.get()<<"\t"<<&s_WindowingSystemInterface<<std::endl;
- return s_WindowingSystemInterface.get();
+ ref_ptr<GraphicsContext::WindowingSystemInterface> &wsref = windowingSystemInterfaceRef();
+ osg::notify(osg::INFO)<<"GraphicsContext::getWindowingSystemInterface() "<<wsref.get()<<"\t"<<&wsref<<std::endl;
+ return wsref.get();
}
GraphicsContext* GraphicsContext::createGraphicsContext(Traits* traits)
{
- if (s_WindowingSystemInterface.valid())
+ ref_ptr<GraphicsContext::WindowingSystemInterface> &wsref = windowingSystemInterfaceRef();
+ if ( wsref.valid())
{
// catch any undefined values.
if (traits) traits->setUndefinedScreenDetailsToDefaultScreen();
- return s_WindowingSystemInterface->createGraphicsContext(traits);
+ return wsref->createGraphicsContext(traits);
}
else
return 0;
View
50 src/osgPlugins/Inventor/ConvertToInventor.cpp
@@ -210,7 +210,7 @@ void ConvertToInventor::apply(osg::Node &node)
template<typename fieldClass, typename ivType, typename osgType>
-static void osgArray2ivMField_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0)
+void osgArray2ivMField_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0)
{
int i,num = array->getNumElements();
if (startIndex!=0 || stopIndex!=0) {
@@ -250,31 +250,31 @@ static void osgArray2ivMField_template(const osg::Array *array, fieldClass &fiel
template<typename ivType, typename osgType, int shift>
-static void osgArray2ivMField_composite_template_worker(ivType *dest, osgType *src, int num, int numItemsUntilMinusOne = 0)
+void osgArray2ivMField_composite_template_worker(ivType *dest, osgType *src, int num, int numItemsUntilMinusOne = 0)
{
for (int i=0; i<num; i++, src+=shift)
dest[i] = ivType(src);
}
template<>
-static void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor *dest, GLubyte *src, int num, int numItemsUntilMinusOne)
+void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor *dest, GLubyte *src, int num, int numItemsUntilMinusOne)
{
for (int i=0; i<num; i++, src+=4)
dest[i].setValue(src[0]/255.f, src[1]/255.f, src[2]/255.f);
}
template<>
-static void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f *dest, float *src, int num, int numItemsUntilMinusOne)
+void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f *dest, float *src, int num, int numItemsUntilMinusOne)
{
for (int i=0; i<num; i++, src+=2)
dest[i].setValue(src[0], src[1], 0.f);
}
template<typename fieldClass, typename ivType, typename osgType, int shift>
-static void osgArray2ivMField_composite_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0)
+void osgArray2ivMField_composite_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0)
{
int num = array->getNumElements();
if (startIndex!=0 || stopIndex!=0) {
@@ -295,7 +295,7 @@ static void osgArray2ivMField_composite_template(const osg::Array *array, fieldC
template<typename fieldClass, typename ivType, typename osgType, int numComponents>
-static void osgArray2ivMField_pack_template(const osg::Array *array, fieldClass &field,
+void osgArray2ivMField_pack_template(const osg::Array *array, fieldClass &field,
osgType mul, osgType max, osgType min,
int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0)
{
@@ -326,7 +326,7 @@ static void osgArray2ivMField_pack_template(const osg::Array *array, fieldClass
template<typename fieldClass, typename fieldItemType>
-static bool applicateIntType(const osg::Array *array, fieldClass &field, int startIndex, int stopIndex, int numItemsUntilMinusOne)
+bool ivApplicateIntType(const osg::Array *array, fieldClass &field, int startIndex, int stopIndex, int numItemsUntilMinusOne)
{
if (field.isOfType(fieldClass::getClassTypeId()))
{
@@ -367,10 +367,10 @@ static void osgArray2ivMField(const osg::Array *array, SoMField &field, int star
(array, (SoMFFloat&)field, startIndex, stopIndex, numItemsUntilMinusOne); return;
}
}
- else if (applicateIntType<SoMFInt32, int32_t>(array, (SoMFInt32&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
- else if (applicateIntType<SoMFUInt32,uint32_t>(array, (SoMFUInt32&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
- else if (applicateIntType<SoMFShort, int16_t>(array, (SoMFShort&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
- else if (applicateIntType<SoMFUShort,uint16_t>(array, (SoMFUShort&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
+ else if (ivApplicateIntType<SoMFInt32, int32_t>(array, (SoMFInt32&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
+ else if (ivApplicateIntType<SoMFUInt32,uint32_t>(array, (SoMFUInt32&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
+ else if (ivApplicateIntType<SoMFShort, int16_t>(array, (SoMFShort&) field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
+ else if (ivApplicateIntType<SoMFUShort,uint16_t>(array, (SoMFUShort&)field, startIndex, stopIndex, numItemsUntilMinusOne)) return;
else if (field.isOfType(SoMFVec2f::getClassTypeId()))
{
switch (array->getType())
@@ -415,7 +415,7 @@ static void osgArray2ivMField(const osg::Array *array, SoMField &field, int star
template<typename variableType, typename indexType>
-static bool deindex(variableType *dest, const variableType *src, const int srcNum,
+bool ivDeindex(variableType *dest, const variableType *src, const int srcNum,
const indexType *indices, const int numToProcess)
{
for (int i=0; i<numToProcess; i++) {
@@ -428,7 +428,7 @@ static bool deindex(variableType *dest, const variableType *src, const int srcNu
template<typename variableType>
-static bool deindex(variableType *dest, const variableType *src, const int srcNum,
+bool ivDeindex(variableType *dest, const variableType *src, const int srcNum,
const osg::Array *indices, const int numToProcess)
{
if (int(indices->getNumElements()) < numToProcess) {
@@ -439,17 +439,17 @@ static bool deindex(variableType *dest, const variableType *src, const int srcNu
switch (indices->getType()) {
case osg::Array::ByteArrayType:
case osg::Array::UByteArrayType:
- return deindex<variableType, GLbyte>(dest, src, srcNum,
+ return ivDeindex<variableType, GLbyte>(dest, src, srcNum,
(GLbyte*)indices->getDataPointer(), numToProcess);
break;
case osg::Array::ShortArrayType:
case osg::Array::UShortArrayType:
- return deindex<variableType, GLshort>(dest, src, srcNum,
+ return ivDeindex<variableType, GLshort>(dest, src, srcNum,
(GLshort*)indices->getDataPointer(), numToProcess);
break;
case osg::Array::IntArrayType:
case osg::Array::UIntArrayType:
- return deindex<variableType, GLint>(dest, src, srcNum,
+ return ivDeindex<variableType, GLint>(dest, src, srcNum,
(GLint*)indices->getDataPointer(), numToProcess);
break;
default:
@@ -460,7 +460,7 @@ static bool deindex(variableType *dest, const variableType *src, const int srcNu
template<typename variableType, typename fieldType>
-static bool processArray(const osg::Array *indices, const osg::Array *drawElemIndices,
+bool ivProcessArray(const osg::Array *indices, const osg::Array *drawElemIndices,
fieldType *destField, const fieldType *srcField,
int startIndex, int numToProcess)
{
@@ -470,11 +470,11 @@ static bool processArray(const osg::Array *indices, const osg::Array *drawElemIn
// "deindex" original data
if (indices && !drawElemIndices)
- ok = deindex<variableType>(destField->startEditing(),
+ ok = ivDeindex<variableType>(destField->startEditing(),
srcField->getValues(startIndex),
srcField->getNum(), indices, numToProcess); else
if (!indices && drawElemIndices)
- ok = deindex<variableType>(destField->startEditing(),
+ ok = ivDeindex<variableType>(destField->startEditing(),
srcField->getValues(startIndex),
srcField->getNum(), drawElemIndices, numToProcess);
else {
@@ -1197,7 +1197,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedCoords = new SoCoordinate4;
if (ok) {
((SoCoordinate4*)nonIndexedCoords)->point.setNum(n);
- ok = processArray<SbVec4f,SoMFVec4f>(g->getVertexIndices(),
+ ok = ivProcessArray<SbVec4f,SoMFVec4f>(g->getVertexIndices(),
drawElemIndices,
&((SoCoordinate4*)nonIndexedCoords)->point,
&((SoCoordinate4*)ivCoords)->point,
@@ -1207,7 +1207,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedCoords = new SoCoordinate3;
if (ok) {
((SoCoordinate3*)nonIndexedCoords)->point.setNum(n);
- ok = processArray<SbVec3f,SoMFVec3f>(g->getVertexIndices(),
+ ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getVertexIndices(),
drawElemIndices,
&((SoCoordinate3*)nonIndexedCoords)->point,
&((SoCoordinate3*)ivCoords)->point,
@@ -1221,7 +1221,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedTexCoords = new SoTextureCoordinate2;
if (ok) {
((SoTextureCoordinate2*)nonIndexedTexCoords)->point.setNum(n);
- ok = processArray<SbVec2f,SoMFVec2f>(g->getTexCoordIndices(0),
+ ok = ivProcessArray<SbVec2f,SoMFVec2f>(g->getTexCoordIndices(0),
drawElemIndices,
&((SoTextureCoordinate2*)nonIndexedTexCoords)->point,
&((SoTextureCoordinate2*)ivTexCoords)->point,
@@ -1232,7 +1232,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedTexCoords = new SoTextureCoordinate3;
if (ok) {
((SoTextureCoordinate3*)nonIndexedTexCoords)->point.setNum(n);
- ok = processArray<SbVec3f,SoMFVec3f>(g->getTexCoordIndices(0),
+ ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getTexCoordIndices(0),
drawElemIndices,
&((SoTextureCoordinate3*)nonIndexedTexCoords)->point,
&((SoTextureCoordinate3*)ivCoords)->point,
@@ -1246,7 +1246,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedNormals = new SoNormal;
if (ok) {
nonIndexedNormals->vector.setNum(numNormalsUsed==0 ? 1 : numNormalsUsed);
- ok = processArray<SbVec3f,SoMFVec3f>(g->getNormalIndices(),
+ ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getNormalIndices(),
g->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
&nonIndexedNormals->vector, &ivNormals->vector,
normalStart, numNormalsUsed==0 ? 1 : numNormalsUsed);
@@ -1269,7 +1269,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
&((SoMaterial*)ivMaterial)->diffuseColor :
&((SoBaseColor*)ivMaterial)->rgb;
dstColorField->setNum(numColorsUsed==0 ? 1 : numColorsUsed);
- ok = processArray<SbColor,SoMFColor>(g->getColorIndices(),
+ ok = ivProcessArray<SbColor,SoMFColor>(g->getColorIndices(),
g->getColorBinding()==osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
dstColorField, srcColorField,
colorStart, numColorsUsed==0 ? 1 : numColorsUsed);
View
2 src/osgUtil/Tessellator.cpp
@@ -600,7 +600,7 @@ void Tessellator::reduceArray(osg::Array * cold, const unsigned int nnu)
}
}
-unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom)
+static unsigned int _computeNumberOfPrimitives(const osg::Geometry& geom)
{
unsigned int totalNumberOfPrimitives = 0;

0 comments on commit 15ca8b1

Please sign in to comment.