# Path: cuwo/vector.py
# def ivec3(x=0, y=0, z=0):
# def vec3(x=0, y=0, z=0):
# def qvec3(x=0, y=0, z=0):


import sys
import sdl2
import sdl2.ext
import threading
import math
import os
                import traceback
from cuwo import tgen
from cuwo.vector import Vector3, Quaternion
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.constants import GLfloat_4
from OpenGL.GL import shaders
from OpenGL.GL.ARB.vertex_buffer_object import *
from queue import PriorityQueue, Full
from ctypes import *
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA,
                     GL_UNSIGNED_BYTE, None)
        glBindTexture(GL_TEXTURE_2D, self.depth_texture)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
                     w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, None)

        self.ssao_shader.bind()
        self.ssao_shader.uniform2f("texture_size", float(w), float(h))
        self.ssao_shader.unbind()
        self.old_render_size = self.render_size

    def apply_ssao(self):
        if not self.use_ssao:
            return
        w, h = self.render_size
        self.update_ssao()

        glPushAttrib(GL_ENABLE_BIT)
        glMatrixMode(GL_PROJECTION)
        glPushMatrix()
        glLoadIdentity()
        gluOrtho2D(0, w, 0, h)
        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        glDisable(GL_DEPTH_TEST)
        glLoadIdentity()

        # texture 0, color
        glActiveTexture(GL_TEXTURE0)
        glEnable(GL_TEXTURE_2D)

# Path: cuwo/vector.py
# def ivec3(x=0, y=0, z=0):
# def vec3(x=0, y=0, z=0):
# def qvec3(x=0, y=0, z=0):


# Path: tools/mapviewer.py
import sys
import sdl2
import sdl2.ext
import threading
import math
import os
                import traceback
from cuwo import tgen
from cuwo.vector import Vector3, Quaternion
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.constants import GLfloat_4
from OpenGL.GL import shaders
from OpenGL.GL.ARB.vertex_buffer_object import *
from queue import PriorityQueue, Full
from ctypes import *

        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA,
                     GL_UNSIGNED_BYTE, None)
        glBindTexture(GL_TEXTURE_2D, self.depth_texture)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
                     w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, None)

        self.ssao_shader.bind()
        self.ssao_shader.uniform2f("texture_size", float(w), float(h))
        self.ssao_shader.unbind()
        self.old_render_size = self.render_size

    def apply_ssao(self):
        if not self.use_ssao:
            return
        w, h = self.render_size
        self.update_ssao()

        glPushAttrib(GL_ENABLE_BIT)
        glMatrixMode(GL_PROJECTION)
        glPushMatrix()
        glLoadIdentity()
        gluOrtho2D(0, w, 0, h)
        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        glDisable(GL_DEPTH_TEST)
        glLoadIdentity()

        # texture 0, color
        glActiveTexture(GL_TEXTURE0)
        glEnable(GL_TEXTURE_2D)

        glBindTexture(GL_TEXTURE_2D, self.color_texture)