PDA

View Full Version : Loading Object Time


new_horizon
10-14-2011, 03:48 AM
Hi All,

I am running an experiment currently that involves loading a number of photographic stimuli into Vizard. I have created a city scene myself by scaling different photographs and also created multiple vehicles within the scene through scaling different photographs.

My question is - the first trial always takes a little longer to load and seems to only be a very brief presentation.

Is there a way to load the city in that will not take up so much memory? Below is how I set up the city (I'm sure there is a more efficient coding method).

Best wishes

#Create sky
sky = viz.add('skydome.dlc')
sky.texture(viz.add(viz.ENVIRONMENT_MAP,'sky.jpg') )

# ----------------------------------------------#
# SET UP GRID LINES #
# ----------------------------------------------#
grid = vizshape.addGrid([2,1],step=0.2,boldStep=None,axis=vizshape.AXIS_Z,paren t=viz.SCREEN)
grid.color(viz.RED)
grid.setPosition([0,0.5,0])
grid.visible(viz.OFF)

# ----------------------------------------------#
# SET UP RESPONSE Zones #
# ----------------------------------------------#
zone1button = viz.addButton( pos = (0.1,0.5,1), )
zone2button = viz.addButton( pos = (0.3,0.5,1), )
zone3button = viz.addButton( pos = (0.5,0.5,1), )
zone4button = viz.addButton( pos = (0.7,0.5,1), )
zone5button = viz.addButton( pos = (0.9,0.5,1), )
nonebutton = viz.addButton( pos = (0.5,0.05,0.5), )
zone1button.visible(viz.OFF)
zone1button.disable(viz.RENDERING)
zone2button.visible(viz.OFF)
zone2button.disable(viz.RENDERING)
zone3button.visible(viz.OFF)
zone3button.disable(viz.RENDERING)
zone4button.visible(viz.OFF)
zone4button.disable(viz.RENDERING)
zone5button.visible(viz.OFF)
zone5button.disable(viz.RENDERING)
nonebutton.uppicture('none.tif')
nonebutton.visible(viz.OFF)
zone1button.setScale(6.5,30,0.1)
zone2button.setScale(6.5,30,0.1)
zone3button.setScale(6.5,30,0.1)
zone4button.setScale(6.5,30,0.1)
zone5button.setScale(6.5,30,0.1)
nonebutton.setScale(6.5,3,1)
#
# Get array module
# Infinite Street Scene
# Left Section 2
viz.startLayer(viz.POLYGON)
viz.texcoord(100,1)
viz.vertex(100,1,0)
viz.texcoord(100,0)
viz.vertex(100,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background1 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background1.texture(Building)
Background1_Scale = [100, 30, 10]
Background1.setScale(Background1_Scale)
Background1.setPosition(-20,-0.5,110)
Background1.setEuler(90,0,0)
# Right Section 2
viz.startLayer(viz.POLYGON)
viz.texcoord(3,1)
viz.vertex(3,1,0)
viz.texcoord(3,0)
viz.vertex(3,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background2 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background2.texture(Building)
Background2_Scale = [75, 30, 10]
Background2.setScale(Background2_Scale)
Background2.setPosition(27,-0.5,110)
Background2.setEuler(90,0,0)

# Infinite Street Scene # Junction Buildings Far
# Left Section 2
viz.startLayer(viz.POLYGON)
viz.texcoord(100,1)
viz.vertex(100,1,0)
viz.texcoord(100,0)
viz.vertex(100,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background1 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background1.texture(Building)
Background1_Scale = [100, 30, 10]
Background1.setScale(Background1_Scale)
Background1.setPosition(-10050,-0.5,500)
Background1.setEuler(0,0,0)
# Right Section 2
viz.startLayer(viz.POLYGON)
viz.texcoord(10000,1)
viz.vertex(10000,1,0)
viz.texcoord(10000,0)
viz.vertex(10000,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background2 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background2.texture(Building)
Background2_Scale = [100, 30, 10]
Background2.setScale(Background2_Scale)
Background2.setPosition(30,-0.5,500)
Background2.setEuler(0,0,0)

# Junction Near
# Right Section 2
viz.startLayer(viz.POLYGON)
viz.texcoord(3,1)
viz.vertex(3,1,0)
viz.texcoord(3,0)
viz.vertex(3,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background2 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background2.texture(Building)
Background2_Scale = [100, 30, 10]
Background2.setScale(Background2_Scale)
Background2.setPosition(27,-0.5,-115)
Background2.setEuler(0,0,0)

# Infinite Street Scene
# Left Section 1
viz.startLayer(viz.POLYGON)
viz.texcoord(10,1)
viz.vertex(10,1,0)
viz.texcoord(10,0)
viz.vertex(10,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background5 = viz.endLayer()
Building5 = viz.add('Building.tif')
Building5.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background5.texture(Building)
Background5_Scale = [100, 30, 10]
Background5.setScale(Background5_Scale)
Background5.setPosition(-50,-0.5,1500)
Background5.setEuler(90,0,0)
# Right Section 1
viz.startLayer(viz.POLYGON)
viz.texcoord(10,1)
viz.vertex(10,1,0)
viz.texcoord(10,0)
viz.vertex(10,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background2 = viz.endLayer()
Building = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background2.texture(Building)
Background2_Scale = [100, 30, 10]
Background2.setScale(Background2_Scale)
Background2.setPosition(30,-0.5,1500)
Background2.setEuler(90,0,0)


# Infinite Road Strip
viz.startLayer(viz.POLYGON)
viz.texcoord(10000,1)
viz.vertex(10000,1,0)
viz.texcoord(10000,0)
viz.vertex(10000,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
Background1 = viz.endLayer()
Building = viz.add('Road Markings.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
Background1.texture(Building)
Background1_Scale = [100, 30, 10]
Background1.setScale(Background1_Scale)
Background1.setPosition(-7.5,0,10000)
Background1.setEuler(90,90,0)

# Junction Road Strip
junctionroad = viz.addTexture('Road Markings Junction.tif')
junction = viz.addTexQuad(viz.WORLD,viz.MainScene,35) # 1m sq quad
junction.texture(junctionroad)
junction.setPosition(xobs+19.2,0.01,-160)
junction.setEuler(90,90,0)


## Create Far Away Buildings ##
viz.startLayer(viz.POLYGON)
viz.texcoord(10000,1)
viz.vertex(10000,1,0)
viz.texcoord(10000,0)
viz.vertex(10000,0,0)
viz.texcoord(0,0)
viz.vertex(0,0,0)
viz.texcoord(0,1)
viz.vertex(0,1,0)
BackgroundFar = viz.endLayer()
BuildingFar = viz.add('Building.tif')
Building.wrap(viz.WRAP_S,viz.REPEAT)
#t.wrap(viz.WRAP_T,viz.REPEAT)
BackgroundFar.texture(BuildingFar)
BackgroundFar_Scale = [100, 30, 10]
BackgroundFar.setScale(BackgroundFar_Scale)
BackgroundFar.setPosition(-300,-10,1500)