Last change
on this file since 1306 was
1198,
checked in by Maciej Komosinski, 21 months ago
|
Added simple Python GUI for Framsticks library/server
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1198] | 1 | from gui.visual.shaderProgram import ShaderProgram
|
---|
| 2 | import OpenGL.GL as gl
|
---|
| 3 | import glm
|
---|
| 4 |
|
---|
| 5 | class 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.