31 lines
No EOL
791 B
Python
31 lines
No EOL
791 B
Python
#!/usr/bin/python3
|
|
|
|
from settings import *
|
|
from mesh.base import BaseMesh
|
|
|
|
|
|
class QuadMesh(BaseMesh):
|
|
def __init__(self, app):
|
|
super().__init__()
|
|
|
|
self.app = app
|
|
self.ctx = app.ctx
|
|
self.program = app.shader_program.quad
|
|
|
|
self.vbo_format = "3f 3f"
|
|
self.attributes = ("in_position", "in_color")
|
|
self.vao = self.get_vao()
|
|
|
|
def get_vertex_data(self):
|
|
vertices = [
|
|
(0.5, 0.5, 0.0), (-0.5, 0.5, 0.0), (-0.5, -0.5, 0.0),
|
|
(0.5, 0.5, 0.0), (-0.5, -0.5, 0.0), (0.5, -0.5, 0.0)
|
|
]
|
|
|
|
colors = [
|
|
(0, 1, 0), (1, 0, 0), (1, 1, 0),
|
|
(0, 1, 0), (1, 1, 0), (0, 0, 1)
|
|
]
|
|
|
|
vertex_data = numpy.hstack([vertices, colors], dtype="float32")
|
|
return vertex_data |