Changeset 8562

Show
Ignore:
Timestamp:
07/11/08 19:35:13
Author:
robert
Message:

From Mathias Froehlich, "Due to the recent data variance changes/discussion:
Change the ac3d loader that can as such only deliver static models to set the
data variance to static for the returned model.
"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/src/osgPlugins/ac/ac3d.cpp

    r7937 r8562  
    245245{ 
    246246    osg::BlendFunc* blendFunc = new osg::BlendFunc; 
     247    blendFunc->setDataVariance(osg::Object::STATIC); 
    247248    blendFunc->setSource(osg::BlendFunc::SRC_ALPHA); 
    248249    blendFunc->setDestination(osg::BlendFunc::ONE_MINUS_SRC_ALPHA); 
     
    259260        mMaterial(new osg::Material), 
    260261        mColorArray(new osg::Vec4Array(1)) 
    261     { } 
     262    { 
     263        mMaterial->setDataVariance(osg::Object::STATIC); 
     264        mColorArray->setDataVariance(osg::Object::STATIC); 
     265    } 
    262266 
    263267    void readMaterial(std::istream& stream) 
     
    328332    { 
    329333        mTexture2D = new osg::Texture2D; 
     334        mTexture2D->setDataVariance(osg::Object::STATIC); 
    330335        mTexture2D->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT); 
    331336        mTexture2D->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT); 
     
    362367            return; 
    363368        osg::TexEnv* texEnv = new osg::TexEnv; 
     369        texEnv->setDataVariance(osg::Object::STATIC); 
    364370        texEnv->setMode(osg::TexEnv::MODULATE); 
    365371        stateSet->setTextureAttribute(0, texEnv); 
     
    394400    { 
    395401        osg::Light* light = new osg::Light; 
     402        light->setDataVariance(osg::Object::STATIC); 
    396403        light->setLightNum(mLightIndex++); 
    397404        return light; 
     
    618625        _vertexSet(vertexSet), 
    619626        _flags(flags) 
    620     { } 
     627    { 
     628        _geode->setDataVariance(osg::Object::STATIC); 
     629    } 
    621630 
    622631    virtual bool beginPrimitive(unsigned nRefs) = 0; 
     
    670679        _texCoords(new osg::Vec2Array) 
    671680    { 
     681        _geometry->setDataVariance(osg::Object::STATIC); 
     682        _vertices->setDataVariance(osg::Object::STATIC); 
     683        _texCoords->setDataVariance(osg::Object::STATIC); 
    672684        _geometry->setVertexArray(_vertices.get()); 
    673685        _geometry->setTexCoordArray(0, _texCoords.get()); 
     
    885897        } else { 
    886898            osg::CullFace* cullFace = new osg::CullFace; 
     899            cullFace->setDataVariance(osg::Object::STATIC); 
    887900            cullFace->setMode(osg::CullFace::BACK); 
    888901            stateSet->setAttribute(cullFace); 
     
    892905        // Flat or smooth shading 
    893906        osg::ShadeModel* shadeModel = new osg::ShadeModel; 
     907        shadeModel->setDataVariance(osg::Object::STATIC); 
    894908        if (isSmooth()) 
    895909            shadeModel->setMode(osg::ShadeModel::SMOOTH); 
     
    901915        osg::Geometry* geometry = new osg::Geometry; 
    902916        _geode->addDrawable(geometry); 
     917        geometry->setDataVariance(osg::Object::STATIC); 
    903918        geometry->setColorArray(material.getColorArray()); 
    904919        geometry->setColorBinding(osg::Geometry::BIND_OVERALL); 
    905920        geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); 
    906921        osg::Vec3Array* normalArray = new osg::Vec3Array; 
     922        normalArray->setDataVariance(osg::Object::STATIC); 
    907923        geometry->setNormalArray(normalArray); 
    908924        osg::Vec3Array* vertexArray = new osg::Vec3Array; 
     925        vertexArray->setDataVariance(osg::Object::STATIC); 
    909926        geometry->setVertexArray(vertexArray); 
    910927        osg::Vec2Array* texcoordArray = 0; 
     
    912929        { 
    913930            texcoordArray = new osg::Vec2Array; 
     931            texcoordArray->setDataVariance(osg::Object::STATIC); 
    914932            geometry->setTexCoordArray(0, texcoordArray); 
    915933        } 
     
    10791097    osg::ref_ptr<VertexSet> vertexSet = new VertexSet; 
    10801098    osg::ref_ptr<osg::Group> group = new osg::Group; 
     1099    group->setDataVariance(osg::Object::STATIC); 
    10811100    osg::Vec2 textureOffset(0, 0); 
    10821101    osg::Vec2 textureRepeat(1, 1); 
     
    13121331                ac3dLight->setSpecular(osg::Vec4(1.0f,1.0f,0.5f,1.0f)); 
    13131332                 
    1314                 osg::LightSource* ac3dLightSource = new osg::LightSource;     
     1333                osg::LightSource* ac3dLightSource = new osg::LightSource; 
     1334                ac3dLightSource->setDataVariance(osg::Object::STATIC); 
    13151335                ac3dLightSource->setLight(ac3dLight); 
    13161336                ac3dLightSource->setLocalStateSetModes(osg::StateAttribute::ON); 
     
    13301350{ 
    13311351    FileData fileData(options); 
    1332     osg::Matrix idetityTransform; 
    1333     osg::Node* node = readObject(stream, fileData, idetityTransform, TextureData()); 
     1352    osg::Matrix identityTransform; 
     1353    osg::Node* node = readObject(stream, fileData, identityTransform, TextureData()); 
    13341354    if (node) 
    13351355      node->setName("World");