source: framspy/gui/visual/skyboxShader.py @ 1303

Last change on this file since 1303 was 1198, checked in by Maciej Komosinski, 22 months ago

Added simple Python GUI for Framsticks library/server

File size: 1.2 KB
Line 
1from gui.visual.shaderProgram import ShaderProgram
2import OpenGL.GL as gl
3import glm
4
5class SkyboxShader(ShaderProgram):
6    def __init__(self) -> None:
7        super().__init__("visual/shaders/SkyboxVertexShader.glsl", "visual/shaders/SkyboxFragmentShader.glsl")
8        self.bindAttributes()
9        gl.glLinkProgram(self.programID)
10        gl.glValidateProgram(self.programID)
11        self.getAllUniformLocations()
12
13    def loadProjectionMatrix(self, matrix):
14        self.loadMatrix4(self.location_projectionMatrix, matrix)
15
16    def loadViewMatrix(self, camera):
17        viewMatrix = glm.lookAt(camera.position, camera.player.position, glm.vec3(0, 0, 1))
18        viewMatrix[3][0] = 0
19        viewMatrix[3][1] = 0
20        viewMatrix[3][2] = 0
21        self.loadMatrix4(self.location_viewMatrix, viewMatrix)
22
23    def bindAttributes(self):
24        self.bindAttribute(0, "position")
25        self.bindAttribute(1, "textureCoordinates")
26
27    def getAllUniformLocations(self):
28        self.location_projectionMatrix = self.getUniformLocation("projectionMatrix")
29        self.location_viewMatrix = self.getUniformLocation("viewMatrix")
30        location_modelTexture = self.getUniformLocation("modelTexture")
Note: See TracBrowser for help on using the repository browser.