Example #1
0
    def __init__(self, attributes, bone_nodes, bone_offsets, index=None):

        self.vertex_array = VertexArrayObject(attributes, index)
        self.skinning_shader = Shader(SKINNING_VERT, COLOR_FRAG)

        self.bone_nodes = bone_nodes
        self.bone_offsets = bone_offsets
Example #2
0
 def __init__(self, OBJname, MATname):  #loads .obj and .mat files
     self.meshData = []
     self.materialData = []
     self.count = 0
     self.VBOs = []
     self.VAOs = []
     self.shader = Shader("./shaders/diffuseSpec")  #loads the master shader
     self.textures = []
     self.loadMesh(OBJname)
     self.loadMaterial(MATname)
     self.loadDataInGPU()
Example #3
0
    def setup_prim(self):
        self.va = VertexArray()
        self.vbo = VertexBuffer(self.vertices)

        self.layout = VertexBufferLayout()
        self.layout.push_float(3)
        self.layout.push_float(2)
        self.layout.push_float(3)
        self.va.add_buffer(self.vbo, self.layout)
        self.ib = IndexBuffer(self.indices)
        self.shader = Shader('resources/shaders/BasicTextureMVP.glsl')

        self.material.textures.basecolor.setup_texture()
Example #4
0
 def __init__(self, points, sizes, mass):
     '''
     Constructor
     '''
     self._window = 0
     self._first = True
     self._sizes = np.array(sizes)
     self._points = points
     self._pointmasses = mass
     self._pointsGL = None
     self._cornerX = None
     self._cornerY = None
     self._shader = Shader.Shader("Billboard")
     self._texture = 0
Example #5
0
    def __init__(self , fname):
        self.shader = Shader(fname)
        self.mat = MaterialData()
        self.identityMat = pyrr.matrix44.create_identity()
        vertices = [-1 , 1 , -1 , -1 , 1 , 1 , 1 ,  -1]
        vertices =  np.array(vertices, dtype='float32')
        self.vao = glGenVertexArrays(1)
        glBindVertexArray(self.vao)
        self.vbo = glGenBuffers(1)
        glBindBuffer(GL_ARRAY_BUFFER, self.vbo);
        glBufferData(GL_ARRAY_BUFFER,8*4 , vertices, GL_STATIC_DRAW)
        glEnableVertexAttribArray(0);
        glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, None);

        glBindVertexArray(0);
Example #6
0
    def __init__(self, step, cell_size):
        self.step = step
        self.cell_size = cell_size
        self.grid = []

        self.grid_sdr = Shader('resources/shaders/Grid.glsl')
        self.grid_sdr.bind()

        self.layout = VertexBufferLayout()
        self.layout.push_float(2)
        self.VA = VertexArray()

        self.VA.unbind()
        self.grid_sdr.unbind()

        distance = cell_size * step
        grid_array = []
        if step == 0:
            xline = [cell_size, 0.0, -cell_size, 0.0]
            yline = [0.0, cell_size, 0.0, -cell_size]
        else:
            xline = [distance, 0.0, -distance, 0.0]
            yline = [0.0, distance, 0.0, -distance]

        grid_array.extend(xline)
        grid_array.extend(yline)

        if step > 0:
            for i in range(step):
                i = i + 1
                grid_array.extend(
                    [distance, i * cell_size, -distance, i * cell_size])
                grid_array.extend(
                    [distance, -i * cell_size, -distance, -i * cell_size])

                grid_array.extend(
                    [i * cell_size, distance, i * cell_size, -distance])
                grid_array.extend(
                    [-i * cell_size, distance, -i * cell_size, -distance])
        else:
            print("Grid step count can't be negative.")

        self.grid = numpy.array(grid_array, 'f')
        self.VB = VertexBuffer(self.get_grid_array())
        self.VA.add_buffer(self.VB, self.layout)
Example #7
0
    def __init__(self, attributes, index=None):

        self.vertex_array = VertexArrayObject(attributes, index)
        self.shader = Shader(COLOR_VERT, COLOR_FRAG)
Example #8
0
                           y=1010)

# Map
m, inter_map, inter_map_obj, shadow_map = loadmap("map\\draconis")
#m.check_unsigned_data(tile_dictionary, obj_dictionary)

# Lightning
Lightning.propagate_all(inter_map, inter_map_obj, shadow_map)
DLconf = DaylightConfigurator()

# Areas
shader_area_1 = ShaderArea([[30, 30], [30, 40], [40, 30], [40, 40]],
                           (0, 0, 100, 255), 50)

# Shader
shader_layer = Shader()

# Start LAN
LAN_SERVER = Popen("python src\\LAN.py")

# Entities
p = Player(DISC_POS, OFFSET, "src\\Char\\Lianna.png")
entity_dict = {}

# Socket Connection
context = zmq.Context()
socket = context.socket(zmq.DEALER)
HOST = "127.0.0.1"
PORT = 33000
receive_string = "tcp://" + HOST + ":" + str(PORT)
timer_string = "tcp://" + HOST + ":" + str(PORT + 1)
Example #9
0
 def __init__(self, P):
     sf.Drawable.__init__(self)
     self.quad = Quad()
     self.shader = Shader(P)
     self.states = sf.RenderStates(shader=self.shader)