Show
Ignore:
Timestamp:
11/24/14 16:24:31 (9 hours ago)
Author:
robert
Message:

From Jan Klimke, "i noticed, that there are a couple of additional flaws when building osg for Mac OS X 10.10 Yosemite.

The mac os sdk version is recognized by the current CMAKE script as 10.1 instead of 10.10 since it cuts the version string from the 4th place. I introduced a more reliable version checking based on splitting the returned version code into MAJOR MINOR and PATCH parts and reassemble the OSG sdk version afterwards.

I replaced the existing CMake code against the following (returning now version 10.10 as expected):

# Determine the canonical name of the selected Platform SDK

EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"

OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)

STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)

SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")

Also i added the check for the new Version to some more find scripts.

Additionally the nil object in Objective C now seems to be equivalent with a null_ptr that cannot be passed as GLInt anymore. So i switched this in the PixelBufferCocoa?.mm to pass a zero instead of nil.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/stl/ReaderWriterSTL.cpp

    r13133 r13502  
    9898 
    9999            geom->setVertexArray(_vertex.get()); 
    100             geom->setNormalArray(_normal.get()); 
    101             geom->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); 
     100             
     101            if (_normal.valid()) 
     102            { 
     103                // need to convert per triangle normals to per vertex 
     104                osg::ref_ptr<osg::Vec3Array> perVertexNormals = new osg::Vec3Array; 
     105                perVertexNormals->reserveArray(_normal->size() * 3); 
     106                for(osg::Vec3Array::iterator itr = _normal->begin(); 
     107                    itr != _normal->end(); 
     108                    ++itr) 
     109                { 
     110                    perVertexNormals->push_back(*itr); 
     111                } 
     112                 
     113                geom->setNormalArray(perVertexNormals.get()); 
     114                geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); 
     115            } 
     116             
     117            if (_color.valid()) 
     118            { 
     119                // need to convert per triangle colours to per vertex 
     120                OSG_INFO << "STL file with color" << std::endl; 
     121                osg::ref_ptr<osg::Vec4Array> perVertexColours = new osg::Vec4Array; 
     122                perVertexColours->reserveArray(_color->size() * 3); 
     123                for(osg::Vec4Array::iterator itr = _color->begin(); 
     124                    itr != _color->end(); 
     125                    ++itr) 
     126                { 
     127                    perVertexColours->push_back(*itr); 
     128                } 
     129                geom->setColorArray(perVertexColours.get()); 
     130                geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); 
     131            } 
     132 
    102133            geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, _numFacets * 3)); 
    103  
    104             if (_color.valid()) 
    105             { 
    106                 OSG_INFO << "STL file with color" << std::endl; 
    107                 geom->setColorArray(_color.get()); 
    108                 geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); 
    109             } 
    110134 
    111135            osgUtil::TriStripVisitor tristripper;