Esempio n. 1
0
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import jupylet.color

from jupylet.app import App
from jupylet.state import State
from jupylet.label import Label
from jupylet.sprite import Sprite
from jupylet.shadertoy import Shadertoy, get_shadertoy_audio

from jupylet.audio.bundle import *

import numpy as np

app = App(width=512, height=420, quality=100)  #, log_level=logging.INFO)

#
# Default oscilloscope shader:
# The code in the following cell is of a simple shadertoy shader that
# displays an audio oscilloscope. Shadertoy (http://shadertoy.com/) are
# an easy way to create graphic effects by programming the GPU directly:
#
st0 = Shadertoy(
    """

    void mainImage( out vec4 fragColor, in vec2 fragCoord )
    {
        // Normalized pixel coordinates (from 0 to 1)
        vec2 uv = fragCoord / iResolution.xy;
Esempio n. 2
0
sys.path.insert(0, os.path.abspath('./..'))

import glm

import pyglet.window.key as key

from jupylet.label import Label
from jupylet.app import App, State
from jupylet.model import load_blender_gltf

if __name__ == '__main__':
    mode = 'window'
else:
    mode = 'hidden'

app = App(768, 512, mode=mode)

scene = load_blender_gltf('./scenes/moon/alien-moon.gltf')

scene.add_cubemap('./scenes/moon/nebula/nebula*.png', 2.)

camera = scene.cameras['Camera']
camera.zfar = 10000

moon = scene.meshes['Moon']

state = State(
    capslock=False,
    shift=False,
    alt=False,
    up=False,
Esempio n. 3
0
sys.path.insert(0, p1)
os.chdir(p0)

import jupylet.color

from jupylet.app import App, State
from jupylet.label import Label
from jupylet.sprite import Sprite

if __name__ == '__main__':
    mode = 'window'
else:
    mode = 'hidden'

app = App(mode=mode)

window = app.window

WIDTH = app.width
HEIGHT = app.height

background = '#3e32a2'
foreground = '#7c71da'

app.set_window_color(foreground)

a0 = np.ones((32, 32)) * 255
a1 = np.ones((128, 16)) * 255
a2 = np.ones((HEIGHT * 9 // 10, WIDTH * 9 // 10,
              3)) * jupylet.color.color2rgb(background)[:3]
Esempio n. 4
0
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import jupylet.color

from jupylet.env import get_app_mode
from jupylet.app import App
from jupylet.state import State
from jupylet.label import Label
from jupylet.sprite import Sprite

from jupylet.audio.sample import Sample

import moderngl_window.timers.clock as _clock

app = App()

background = '#3e32a2'
foreground = '#7c71da'

a0 = np.ones((32, 32)) * 255
a1 = np.ones((128, 16)) * 255
a2 = np.ones((app.height * 9 // 10, app.width * 9 // 10, 3)) * 255

ball = Sprite(a0, y=app.height / 2, x=app.width / 2)

padl = Sprite(a1, y=app.height / 2, x=48)
padr = Sprite(a1, y=app.height / 2, x=app.width - 48)

field = Sprite(a2, y=app.height / 2, x=app.width / 2, color=background)
Esempio n. 5
0
import glm
import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from jupylet.label import Label
from jupylet.app import App
from jupylet.state import State
from jupylet.loader import load_blender_gltf


logger = logging.getLogger()


app = App(768, 512)

scene = load_blender_gltf('./scenes/lego/lego.gltf')
scene.shadows = True

camera = scene.cameras['Camera']

brick = scene.meshes['brick.green']


state = State(
    
    capslock = False,
    shift = False,
    alt = False,
    
Esempio n. 6
0
sys.path.insert(0, p1)

from jupylet.app import App
from jupylet.label import Label
from jupylet.sprite import Sprite

import pyglet.window.key as key


if __name__ == '__main__':
    mode = 'window'
else:
    mode = 'hidden'

app = App(mode=mode)

window = app.window

WIDTH = app.width
HEIGHT = app.height

stars = Sprite('stars.png', scale=2.5)
alien = Sprite('alien.png', scale=0.5)
ship = Sprite('ship1.png', x=WIDTH/2, y=HEIGHT/2, scale=0.5)
moon = Sprite('moon.png', x=WIDTH-70, y=HEIGHT-70, scale=0.5)

circle = Sprite('yellow-circle.png')
circle.opacity = 0
circle.width = 184
Esempio n. 7
0
    The code displays the beautiful Star Nest Shadertoy by Pablo Roman Andrioli
    https://www.shadertoy.com/view/XlfGRj. 
"""

import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from jupylet.app import App
from jupylet.label import Label
from jupylet.shadertoy import Shadertoy

from jupylet.audio.bundle import *

app = App(width=533, height=300)

st = Shadertoy("""

    // Star Nest by Pablo Roman Andrioli

    // This content is under the MIT License.

    #define iterations 17
    #define formuparam 0.53

    #define volsteps 20
    #define stepsize 0.1

    #define zoom   0.800
    #define tile   0.850
Esempio n. 8
0
from jupylet.label import Label
from jupylet.app import App
from jupylet.state import State
from jupylet.model import Skybox
from jupylet.loader import load_blender_gltf


logger = logging.getLogger()


if __name__ == '__main__':
    mode = 'window'
else:
    mode = 'hidden'

app = App(768, 512, mode=mode)#, log_level=logging.INFO)

scene = load_blender_gltf('./scenes/moon/alien-moon.gltf')

scene.skybox = Skybox('./scenes/moon/nebula/nebula*.png', intensity=2., flip_left_right=True)

scene.shadows = True


sun = scene.lights['Light.Sun']
sun.shadowmaps_depths = [1., 0.12, 0.04, 0.015, 0.0]

moon = scene.meshes['Moon']
moon.shadow_bias = 0.2

camera = scene.cameras['Camera']