コード例 #1
0
def main(argv):

    
    # use an ArgumentParser object to manage the program arguments.
    arguments = osg.ArgumentParser(argv)
    
    # set up the usage document, in case we need to print out how to use this program.
    arguments.getApplicationUsage().setApplicationName(arguments.getApplicationName())
    arguments.getApplicationUsage().setDescription(arguments.getApplicationName()+" is a utility for converting glsl shader files into char arrays that can be compiled into applications.")
    arguments.getApplicationUsage().setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...")
    arguments.getApplicationUsage().addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.")
    arguments.getApplicationUsage().addCommandLineOption("-h or --help","Display command line parameters")

    # if user request help write it out to cout.
    if arguments.read("-h")  or  arguments.read("--help") :
        arguments.getApplicationUsage().write(std.cout)
        return 1
    
    filename = str()
    if arguments.read("--shader",filename) :
        shader = osgDB.readShaderFile(filename)
        if shader.valid() :
            name = osgDB.getStrippedName(filename)
            path = osgDB.getFilePath(filename)
            invalidCharacters = "-+/\\*=()[]:<>,.?@'~#` not \""
            numbericCharacters = "0123456789"
            pos = name.find_first_of(invalidCharacters)
            while pos  not = str.npos :
                name[pos] = ord("_")
                pos = name.find_first_of(invalidCharacters)
            
            ext = osgDB.getFileExtension(filename)
            cppFileName = osgDB.concatPaths(path, name + "_" + ext + ".cpp")
            variableName = name + "_" + ext
            writeShader(shader, cppFileName, variableName)

            return 0
        else:
            print "Error: could not find file '", filename, "'"
            return 1
        

    print "No appropriate command line options used."

    arguments.getApplicationUsage().write(std.cout)
    return 1
コード例 #2
0
def main(argv):

    
    # use an ArgumentParser object to manage the program arguments.
    arguments = osg.ArgumentParser(argv)
    
    # set up the usage document, in case we need to print out how to use this program.
    arguments.getApplicationUsage().setApplicationName(arguments.getApplicationName())
    arguments.getApplicationUsage().setDescription(arguments.getApplicationName()+" is a utility for converting glsl shader files into char arrays that can be compiled into applications.")
    arguments.getApplicationUsage().setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...")
    arguments.getApplicationUsage().addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.")
    arguments.getApplicationUsage().addCommandLineOption("-h or --help","Display command line parameters")

    # if user request help write it out to cout.
    if arguments.read("-h")  or  arguments.read("--help") :
        arguments.getApplicationUsage().write(std.cout)
        return 1
    
    filename = str()
    if arguments.read("--shader",filename) :
        shader = osgDB.readShaderFile(filename)
        if shader.valid() :
            name = osgDB.getStrippedName(filename)
            path = osgDB.getFilePath(filename)
            invalidCharacters = "-+/\\*=()[]:<>,.?@'~#` not \""
            numbericCharacters = "0123456789"
            pos = name.find_first_of(invalidCharacters)
            while pos  not = str.npos :
                name[pos] = ord("_")
                pos = name.find_first_of(invalidCharacters)
            
            ext = osgDB.getFileExtension(filename)
            cppFileName = osgDB.concatPaths(path, name + "_" + ext + ".cpp")
            variableName = name + "_" + ext
            writeShader(shader, cppFileName, variableName)

            return 0
        else:
            print "Error: could not find file '", filename, "'"
            return 1
コード例 #3
0
    _screenHeight(cs._screenHeight),
    _screenDistance(cs._screenDistance),
    _samples(cs._samples),
    _sampleBuffers(cs._sampleBuffers),
    _frameRate(cs._frameRate),
    _numberOfFrames(cs._numberOfFrames),
    _eventHandlers(cs._eventHandlers),
    _properties(cs._properties)

void CaptureSettings.setOutputFileName( str filename)
    _outputFileName = filename
    
    _outputDirectoryName = osgDB.getFilePath(filename)
    if  not _outputDirectoryName.empty() : _outputDirectoryName += osgDB.getNativePathSeparator()
    
    _outputBaseFileName = osgDB.getStrippedName(filename)
    
    _outputExtension = osgDB.getFileExtensionIncludingDot(filename)

 str CaptureSettings.getOutputFileName() 
    return _outputFileName

str CaptureSettings.getOutputFileName(unsigned int frameNumber) 
    str = strstream()
    str, _outputDirectoryName, _outputBaseFileName, "_", frameNumber, _outputExtension
    return str.str()
str CaptureSettings.getOutputFileName(unsigned int cameraNum, unsigned int frameNumber) 
    str = strstream()
    str, _outputDirectoryName, _outputBaseFileName, "_", cameraNum, "_", frameNumber, _outputExtension
    return str.str()