Example #1
0
def displayHeatmap(project=True):
    '''
	 - Load accumulated view textures
	 - Add cube projector with given textures and shader converting intensities to heat map colors
	 - Let projector affect scene
	 - auto_update = True will set the shader uniforms automatically each frame
	'''
    import viz
    import vizact
    import vizcam

    viz.setMultiSample(4)

    viz.go()

    #vizcam.WalkNavigate()

    if project:
        piazza = viz.addChild('piazza.osgb')

        cube_textures = {
            viz.POSITIVE_X: viz.addTexture('accumulated_p_x.bmp'),
            viz.NEGATIVE_X: viz.addTexture('accumulated_n_x.bmp'),
            viz.POSITIVE_Y: viz.addTexture('accumulated_p_y.bmp'),
            viz.NEGATIVE_Y: viz.addTexture('accumulated_n_y.bmp'),
            viz.POSITIVE_Z: viz.addTexture('accumulated_p_z.bmp'),
            viz.NEGATIVE_Z: viz.addTexture('accumulated_n_z.bmp')
        }

        heat_projector = HeatmapVisualizer(cube_textures, auto_update=True)
        heat_projector.setPosition(viz.MainView.getPosition())
        heat_projector.affect(piazza)

        ## GUI for manipulation of the output heatmap

        i_slider = viz.addSlider()
        i_x = 1.0 - i_slider.getBoundingBox().width / 2.0
        i_y = 0.0 + i_slider.getBoundingBox().height / 2.0
        i_slider.setPosition([i_x, i_y, 0])
        i_slider.set(0.5)

        i_text = viz.addText('intensity scale', parent=viz.SCREEN)
        i_text.setPosition([
            i_x - i_text.getBoundingBox().width / 2 -
            i_slider.getBoundingBox().width / 2, 0.01, 0.0
        ])
        i_text.setScale([0.4, 0.4, 1.0])

        def onSlider(obj, pos):
            if obj == i_slider:
                heat_projector.setIntensityScale(pos + 0.5)

        viz.callback(viz.SLIDER_EVENT, onSlider)
    else:
        import vizshape

        env = viz.addEnvironmentMap(
            'accumulated.bmp',
            faces=['_p_x', '_n_x', '_p_y', '_n_y', '_p_z', '_n_z'])

        sb = vizshape.addSkyBox()
        sb.texture(env)
Example #2
0
data1 = HistogramData( data.imageDirectory )
#GrayHistTool =GrayHistogramTool( messageManager, data1, shader_texture)
#ColorHistTool = ColorHistogramTool( messageManager, data1, shader_texture)

#Create annotation tool
#annotationManager = AnnotationManager(messageManager)
#annotationManager.setScale( viz.Vector( 0.1, 0.1, 0.1 ) )

tool_manager = ToolManager(messageManager)


tool_manager.addTool( clipPlaneTool )
#tool_manager.addTool( annotationManager )

#resolution control
res_control = viz.addSlider()
res_control.ticksize(0.3, 0.6)
res_control.setPosition( 0.2, 0.025 )
res_control.set( 0.5 )
res_control_text = viz.addText("Resolution Control:", parent = viz.SCREEN)
res_control_text.setPosition(0.005, 0.0225)
res_control_text.scale( 0.1, 0.1, 0.1 )

#Gradient control
min_gradient_text = viz.addText("Gradient Minimum:", parent = viz.SCREEN)
min_gradient_text.setPosition(0.005, 0.0725)
min_gradient_text.scale( 0.1, 0.1, 0.1 )
min_gradient_control = viz.addSlider()
min_gradient_control.setPosition(0.2, 0.075)
min_gradient_control.set(0.0)
min_gradient_control.ticksize(0.3, 0.6)
Example #3
0


def UpdateMovement():
	global node
	y,p,r = viz.MainView.getEuler()
	node.setEuler([y,p,r])
	x,y,z = viz.MainView.getPosition()
	node.setPosition([x,y,z])
vizact.ontimer(0,UpdateMovement)











fovslider = viz.addSlider()
fovslider.translate(0.2,0.1)
fovslider.set(ARfov_vert/HMDfov_vert)

def onButton(obj,state):
	global fovslider, HMDfov_vert
	if obj == fovslider:
		setARfov( HMDfov_vert * fovslider.get() )

viz.callback(viz.BUTTON_EVENT,onButton)
Example #4
0
#Automatically compute tangent vectors for cubic bezier translations
path.computeTangents()

#Automatically rotate the path
path.setAutoRotate(viz.ON)

#Link the ball to the path
viz.link(path, ball)

#Play the animation path
path.play()

#Setup path control panel
controlPanel = vizinfo.InfoPanel(text=None, title='Settings', icon=False)

slider_speed = controlPanel.addLabelItem('Speed', viz.addSlider())
slider_speed.set(0.1)

controlPanel.addSection('Loop Mode')
radio_loop_off = controlPanel.addLabelItem('Off', viz.addRadioButton('LoopMode'))
radio_loop_on = controlPanel.addLabelItem('Loop', viz.addRadioButton('LoopMode'))
radio_loop_swing = controlPanel.addLabelItem('Swing', viz.addRadioButton('LoopMode'))
radio_loop_circular = controlPanel.addLabelItem('Circular', viz.addRadioButton('LoopMode'))
radio_loop_circular.set(1)

controlPanel.addSection('Interpolation Mode')
radio_interp_linear = controlPanel.addLabelItem('Linear', viz.addRadioButton('InterpolationMode'))
radio_interp_cubic = controlPanel.addLabelItem('Bezier', viz.addRadioButton('InterpolationMode'))
radio_interp_linear.set(1)

def changeSpeed(pos):
Example #5
0
import vizact
import vizinfo

viz.setMultiSample(4)
viz.fov(60)
viz.go()

vizinfo.InfoPanel(align=viz.ALIGN_RIGHT_BOTTOM)

#Turn on the physics engine
viz.phys.enable()

#Interface to change box characteristics
boxInfo = vizinfo.InfoPanel('Box Material Characteristics', align=viz.ALIGN_LEFT_TOP)
boxInfo.addSeparator()
boxScale = boxInfo.addLabelItem('Scale',viz.addSlider())
boxDensity = boxInfo.addLabelItem('Density',viz.addSlider())
boxFriction = boxInfo.addLabelItem('Friction',viz.addSlider())
boxHardness = boxInfo.addLabelItem('Hardness',viz.addSlider())
boxBounce = boxInfo.addLabelItem('Bounce',viz.addSlider())
boxForce = boxInfo.addLabelItem('Force',viz.addSlider())
#Initial material settings
boxScale.set( .5 )
boxDensity.set( .5 )
boxForce.set( .3 )

#Interface to change ball characteristics
ballInfo = vizinfo.InfoPanel( 'Ball Material Characteristics', align=viz.ALIGN_RIGHT_TOP)
ballInfo.addSeparator()
ballScale = ballInfo.addLabelItem('Scale',viz.addSlider())
ballDensity = ballInfo.addLabelItem('Density',viz.addSlider())