# Path: e3d/backends/base_backend.py
# class ShaderStruct(OrderedDict):
#     def __init__(self, *args, **kwds):
#         super(ShaderStruct, self).__init__(*args, **kwds)
# 
#     def __len__(self):
#         res = super(ShaderStruct, self).__len__()
#         for it in self.values():
#             if isinstance(it, list):
#                 res += it.__len__() - 2
#         return res
# 
#     def append(self, key, pyob):
#         if key in self.keys():
#             self.pop(key)
#         self[key] = pyob
# 
#     def updateValue(self, key, value):
#         self[key] = value
# 
# Path: e3d/backends/ogl3/shader_management/ShaderParametersHelper.py
# def getActiveUniforms(program):
#     actives = getShaderActives(program, GL_ACTIVE_UNIFORMS, GL_ACTIVE_UNIFORM_MAX_LENGTH)
#     return actives
# 
# def getActiveAttribs(program):
#     actives = getShaderActives(program, GL_ACTIVE_ATTRIBUTES, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
#     return actives


import numpy as np
from glaze.GL import *
from ...base_backend import ShaderStruct
from .ShaderParametersHelper import getActiveUniforms, getActiveAttribs
        from glaze import GL
            if handle > -1:
                lastValue = self._textureLastValues.get(handle)
                if lastValue is not None and lastValue == value:
                    return
                self._textureUnitsUsed += 1
                unit = self._textureUnitsUsed
                if unit != self._lastActiveUnit:
                    glActiveTexture(self._unitsCache[unit])
                    self._lastActiveUnit = unit
                glBindTexture(GL_TEXTURE_2D, value)
                glUniform1i(handle, unit)
                self._textureLastValues[handle] = value
        else:
            self._engine.log('Error: Max fragment textures units reached ({0})'.format(str(self._maxTextureUnits)),
                       logLevelsEnum.warning)

    def setStruct(self, structParamName, struct):
        """


        @type structParamName: str
        @type struct: ShaderStruct
        """
        for it in struct.items():
            name, val = it
            paramName = structParamName + '.' + name
            if isinstance(val, list):
                handle = self._uniformsHandlesCache.get(paramName, -1)
                if handle >= 0:
                    self.setMultipleValues(handle, val)

# Path: e3d/backends/base_backend.py
# class ShaderStruct(OrderedDict):
#     def __init__(self, *args, **kwds):
#         super(ShaderStruct, self).__init__(*args, **kwds)
# 
#     def __len__(self):
#         res = super(ShaderStruct, self).__len__()
#         for it in self.values():
#             if isinstance(it, list):
#                 res += it.__len__() - 2
#         return res
# 
#     def append(self, key, pyob):
#         if key in self.keys():
#             self.pop(key)
#         self[key] = pyob
# 
#     def updateValue(self, key, value):
#         self[key] = value
# 
# Path: e3d/backends/ogl3/shader_management/ShaderParametersHelper.py
# def getActiveUniforms(program):
#     actives = getShaderActives(program, GL_ACTIVE_UNIFORMS, GL_ACTIVE_UNIFORM_MAX_LENGTH)
#     return actives
# 
# def getActiveAttribs(program):
#     actives = getShaderActives(program, GL_ACTIVE_ATTRIBUTES, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
#     return actives


# Path: e3d/backends/ogl3/shader_management/ShaderClass.py
import numpy as np
from glaze.GL import *
from ...base_backend import ShaderStruct
from .ShaderParametersHelper import getActiveUniforms, getActiveAttribs
        from glaze import GL

            if handle > -1:
                lastValue = self._textureLastValues.get(handle)
                if lastValue is not None and lastValue == value:
                    return
                self._textureUnitsUsed += 1
                unit = self._textureUnitsUsed
                if unit != self._lastActiveUnit:
                    glActiveTexture(self._unitsCache[unit])
                    self._lastActiveUnit = unit
                glBindTexture(GL_TEXTURE_2D, value)
                glUniform1i(handle, unit)
                self._textureLastValues[handle] = value
        else:
            self._engine.log('Error: Max fragment textures units reached ({0})'.format(str(self._maxTextureUnits)),
                       logLevelsEnum.warning)

    def setStruct(self, structParamName, struct):
        """


        @type structParamName: str
        @type struct: ShaderStruct
        """
        for it in struct.items():
            name, val = it
            paramName = structParamName + '.' + name
            if isinstance(val, list):
                handle = self._uniformsHandlesCache.get(paramName, -1)
                if handle >= 0:
                    self.setMultipleValues(handle, val)

            elif isinstance(val, ShaderStruct):