Show
Ignore:
Timestamp:
11/23/09 12:00:07 (4 years ago)
Author:
robert
Message:

From Chris Hanson, " Add support for "OutputTextureFiles?" option to IVE plugin to permit creation of external
.dds texture files from internally-embedded textures during IVE writes."

From Robert Osfield, fixed a bug in the above submission, and changed the way that the filename of the file is passed into DataOutputStream? to avoid issues with the .ive's plugins ability to read from istreams.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/osgTerrain/ImageLayer.cpp

    r8840 r10819  
    1212#include <osgDB/Input> 
    1313#include <osgDB/Output> 
     14#include <osgDB/WriteFile> 
    1415#include <osgDB/ParameterOutput> 
    1516 
     
    6566{ 
    6667    const osgTerrain::ImageLayer& layer = static_cast<const osgTerrain::ImageLayer&>(obj); 
     68 
     69    std::string fileName = layer.getFileName(); 
    6770     
    68     if (!layer.getFileName().empty()) 
     71    if (fw.getOutputTextureFiles()) 
    6972    { 
    70         fw.indent()<<"file "<< layer.getFileName() << std::endl; 
     73        if (fileName.empty()) 
     74        { 
     75            fileName = fw.getTextureFileNameForOutput(); 
     76        } 
     77        osgDB::writeImageFile(*layer.getImage(), fileName); 
     78    } 
     79    if (!fileName.empty()) 
     80    { 
     81        fw.indent()<<"file "<< fw.wrapString(fileName) << std::endl; 
    7182    } 
    7283