Example #1
0
from Kamaelia.Codec.Dirac import DiracDecoder
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Util.RateFilter import MessageRateLimit
from VideoSurface import VideoSurface
from PixFormatConversion import ToRGB_interleaved

from Kamaelia.UI.PygameDisplay import PygameDisplay
from Kamaelia.UI.OpenGL.OpenGLDisplay import OpenGLDisplay
from Kamaelia.UI.OpenGL.PygameWrapper import PygameWrapper
from Kamaelia.UI.OpenGL.SkyGrassBackground import SkyGrassBackground
from Kamaelia.UI.OpenGL.Movement import SimpleRotator

file = "../../../Code/Python/Kamaelia/Examples/VideoCodecs/Dirac/snowboard-jump-352x288x75.0.5.4.drc"
framerate = 15

# override pygame display service
ogl_display = OpenGLDisplay.getDisplayService()
PygameDisplay.setDisplayService(ogl_display[0])

SkyGrassBackground(size=(5000, 5000, 0), position=(0, 0, -100)).activate()
screen = VideoSurface()
screen__in_scene = PygameWrapper(wrap=screen,
                                 position=(0, 0, -5),
                                 rotation=(-30, 15, 3)).activate()
rotator = SimpleRotator(amount=(0.0, 0.0, 0.5)).activate()
rotator.link((rotator, "outbox"), (screen__in_scene, "rel_rotation"))

Pipeline(ReadFileAdaptor(file, readmode="bitrate", bitrate=300000 * 8 / 5),
         DiracDecoder(), ToRGB_interleaved(),
         MessageRateLimit(framerate, buffer=15), screen).run()
Example #2
0
from Kamaelia.Chassis.Graphline import Graphline

o1 = SimpleButton(size=(1, 1, 1)).activate()
o2 = SimpleCube(size=(1, 1, 1)).activate()
o3 = ArrowButton(size=(1, 1, 1)).activate()

containercontents = {
    o1: {
        "position": (0, 1, 0)
    },
    o2: {
        "position": (1, -1, 0)
    },
    o3: {
        "position": (-1, -1, 0)
    },
}

Graphline(OBJ1=o1,
          OBJ2=o2,
          OBJ3=o3,
          CONTAINER=Container(contents=containercontents,
                              position=(0, 0, -10)),
          MOVER=SimpleMover(amount=(0.01, 0.02, 0.03)),
          ROTATOR=SimpleRotator(amount=(0, 0.1, 0)),
          linkages={
              ("MOVER", "outbox"): ("CONTAINER", "position"),
              ("ROTATOR", "outbox"): ("CONTAINER", "rel_rotation")
          }).run()
# Licensed to the BBC under a Contributor Agreement: THF
Example #3
0
points = [(3,3,-20),
          (4,0,-20),
          (3,-3,-20),
          (0,-4,-20),
          (-3,-3,-20),
          (-4,0,-20),
          (-3,3,-20),
          (0,4,-20),
          (3,3,-20),
         ]
path = LinearPath(points, 1000)

cube1 = SimpleCube(size=(1,1,1)).activate()
pathmover = PathMover(path).activate()
pathmover.link((pathmover,"outbox"), (cube1,"position"))

cube2 = SimpleCube(size=(1,1,1)).activate()
simplemover = SimpleMover(borders=(3,5,7)).activate()
simplemover.link((simplemover,"outbox"), (cube2,"position"))

cube3 = SimpleCube(size=(1,1,1), position=(-1,0,-15)).activate()
rotator = SimpleRotator().activate()
rotator.link((rotator,"outbox"), (cube3,"rel_rotation"))

cube4 = SimpleCube(size=(1,1,1), position=(1,0,-15)).activate()
buzzer = SimpleBuzzer().activate()
buzzer.link((buzzer,"outbox"), (cube4,"scaling"))

Axon.Scheduler.scheduler.run.runThreads()  
# Licensed to the BBC under a Contributor Agreement: THF
Example #4
0
    (3, 3, -20),
    (4, 0, -20),
    (3, -3, -20),
    (0, -4, -20),
    (-3, -3, -20),
    (-4, 0, -20),
    (-3, 3, -20),
    (0, 4, -20),
    (3, 3, -20),
]
path = LinearPath(points, 1000)

cube1 = SimpleCube(size=(1, 1, 1)).activate()
pathmover = PathMover(path).activate()
pathmover.link((pathmover, "outbox"), (cube1, "position"))

cube2 = SimpleCube(size=(1, 1, 1)).activate()
simplemover = SimpleMover(borders=(3, 5, 7)).activate()
simplemover.link((simplemover, "outbox"), (cube2, "position"))

cube3 = SimpleCube(size=(1, 1, 1), position=(-1, 0, -15)).activate()
rotator = SimpleRotator().activate()
rotator.link((rotator, "outbox"), (cube3, "rel_rotation"))

cube4 = SimpleCube(size=(1, 1, 1), position=(1, 0, -15)).activate()
buzzer = SimpleBuzzer().activate()
buzzer.link((buzzer, "outbox"), (cube4, "scaling"))

Axon.Scheduler.scheduler.run.runThreads()
# Licensed to the BBC under a Contributor Agreement: THF