Ejemplo n.º 1
0
    def __init__(self, application):
        self.application = application
        self.width, self.height = width, height = application.mesh_width, application.mesh_height
       
        col = Column() 
        self.input_height = LabelInput('Height', self).append_to(col).input
        self.material = LabelInput('Material', self).append_to(col).input
        
        self.widget = Widget('Terrain', col, id='terrain').append_to(application.workspace)

        self.default_material = Texture(2, 2, GL_RGBA, data=(140, 140, 140, 255)*4)
        self.vertex_texture = Texture(width, height, GL_RGBA32F)
        self.normal_texture = Texture(application.width, application.height, GL_RGBA32F, unit=GL_TEXTURE0)

        self.vertex_fbo = Framebuffer(self.vertex_texture)
        self.normal_fbo = Framebuffer(self.normal_texture)

        self.update_vertex_shader = application.shader('update_vertex.frag')
        self.update_normals_shader = application.shader('update_normals.frag')
        self.update_normals_shader.vars.offsets = 1.0/application.width, 1.0/application.height

        self.reset_vertex = application.shader('reset_vertex.frag')
        self.reset_normals = application.shader('reset_normals.frag')
        self.vbo = self.generate_vbo(width, height)

        self.reset()
        self.updated = None
Ejemplo n.º 2
0
    def __init__(self, label, application):
        self.application = application
        self.id = os.urandom(16).encode('hex')

        application.add_node(self)
        self.column = Column()
        bar_area = Area().add_class('widget_bar')
        Label(label).append_to(bar_area)
        Button().append_to(bar_area).on_click = self.delete
        self.texture = application.create_texture()
        self.widget = Widget(bar_area,
                             self.column).add_class('node').append_to(
                                 application.workspace)
        self._parameters = {}
        self.sources = {}
        self.updated = None
        self.optional = []
Ejemplo n.º 3
0
 def message(self, title, text):
     col = Column()
     Label(text).append_to(col)
     Button('Close').append_to(col).on_click = self.exit
     Widget(title, col,
            dragable=False).append_to(self.root).add_class('message')