Пример #1
0
def createTextGroup(text):

    
    group = osg.Group()

    pos = osg.Vec3(120.0, 800.0, 0.0)
    delta =  osg.Vec3(0.0, -60.0, 0.0)

    # header
    t = text
    group.addChild(createText(*t++, pos))
    pos += delta

    # remainder of text under sequence
    seq = osg.Sequence()
    group.addChild(seq)
    while *t : 
        seq.addChild(createText(*t++, pos))
        seq.setTime(seq.getNumChildren()-1, 2.0)
        pos += delta

    # loop through all children
    seq.setInterval(osg.Sequence.LOOP, 0,-1)

    # real-time playback, repeat indefinitively
    seq.setDuration(1.0, -1)

    # must be started explicitly
    seq.setMode(osg.Sequence.START)

    return group
Пример #2
0
def createSequence(arguments):

    
    # assumes any remaining parameters are models
    seq = osg.Sequence()

    typedef std.vector<str> Filenames
    filenames = Filenames()
    
    if arguments.argc() > 1 :
        for (int i = 1 i < arguments.argc() ++i)
            filenames.push_back(arguments[i])
Пример #3
0
    alignmentList.push_back(AlignmentPair(osgText.Text.LEFT_BOTTOM,"text.setAlignment(\nosgText.Text.LEFT_BOTTOM)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.CENTER_TOP,"text.setAlignment(\nosgText.Text.CENTER_TOP)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.CENTER_CENTER,"text.setAlignment(\nosgText.Text.CENTER_CENTER)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.CENTER_BOTTOM,"text.setAlignment(\nosgText.Text.CENTER_BOTTOM)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.RIGHT_TOP,"text.setAlignment(\nosgText.Text.RIGHT_TOP)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.RIGHT_CENTER,"text.setAlignment(\nosgText.Text.RIGHT_CENTER)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.RIGHT_BOTTOM,"text.setAlignment(\nosgText.Text.RIGHT_BOTTOM)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.LEFT_BASE_LINE,"text.setAlignment(\nosgText.Text.LEFT_BASE_LINE)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.CENTER_BASE_LINE,"text.setAlignment(\nosgText.Text.CENTER_BASE_LINE)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.RIGHT_BASE_LINE,"text.setAlignment(\nosgText.Text.RIGHT_BASE_LINE)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.LEFT_BOTTOM_BASE_LINE,"text.setAlignment(\nosgText.Text.LEFT_BOTTOM_BASE_LINE)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.CENTER_BOTTOM_BASE_LINE,"text.setAlignment(\nosgText.Text.CENTER_BOTTOM_BASE_LINE)"))
    alignmentList.push_back(AlignmentPair(osgText.Text.RIGHT_BOTTOM_BASE_LINE,"text.setAlignment(\nosgText.Text.RIGHT_BOTTOM_BASE_LINE)"))


    sequence = osg.Sequence()
        for(AlignmentList.iterator itr=alignmentList.begin()
            not = alignmentList.end()
            ++itr)
            alignmentGeode = osg.Geode()
            sequence.addChild(alignmentGeode)
            sequence.setTime(sequence.getNumChildren(), 1.0)

            text = osgText.Text()
            text.setFont(font)
            text.setColor(alignmentSizeColor)
            text.setCharacterSize(alignmentCharacterSize)
            text.setPosition(cursor)
            text.setDrawMode(osgText.Text.TEXT|osgText.Text.ALIGNMENT|osgText.Text.BOUNDINGBOX)
            
            text.setAlignment(itr.first)
Пример #4
0
                    mode = osg.Sequence.LoopMode()
                    int begin, end
                    _seq.getInterval(mode, begin, end)
                    if mode == osg.Sequence.LOOP : 
                        mode = osg.Sequence.SWING
                        std.cerr, "Swing"
                    else:
                        mode = osg.Sequence.LOOP
                        std.cerr, "Loop"
                    _seq.setInterval(mode, begin, end)
                break
            default:
                break

        return False
    _seq = osg.Sequence()



def main(argv):


    
    # use an ArgumentParser object to manage the program arguments.
    arguments = osg.ArgumentParser(argv)
   
    # construct the viewer.
    viewer = osgViewer.Viewer()
    # root
    rootNode = osg.Group()