Exemple #1
0
    def __init__(self, mapfile, no_gl=False): #height_map = None, textures = None, shader = None):
        self._dimensions = (0,0)

        self._map_locations = {}

        self._marker_colors = {}
        self._no_gl = no_gl

        self._player_initial_position = (0,0)
        self._bases_positions = []
        self._drop_point_positions = []
        self._target_point_positions = []
        self._enemy_start_positions = []
        self._map = None
        self._normals = None

        self._indices_vbo = None
        self._map_positions_vbo = None
        self._patch_index_offsets = []
        self._total_patches = 0
        self._vao = 0

        self.loadConfig(mapfile)

        self._shader = None

        if not no_gl:
            if self._shader_name:
                self._shader = R.getShaderProgram(self._shader_name)
                self._map_world_scale_loc = self._shader.getUniformPos("world_scale")
            else:
                self._map_world_scale_loc = -1

        if self._height_map is not None:
            self.loadMap()
Exemple #2
0
        def __init__(self, shader_name, texture_name):
            self._shader_name = shader_name
            self._texture_name = texture_name

            self._shader = R.getShaderProgram(shader_name)

            self._tbinder = None
            self._texture = None

            if texture_name:
                self._texture = R.loadTexture(texture_name) if texture_name else None
                if self._texture:
                    tloc = self._shader.getUniformPos("texture0")
                    self._tbinder = self._texture.getBinder(0, tloc) if tloc>-1 else None

            self._tot_vert_gl = 0
            self._ofs_gl = None

            for uni in self._uniforms:
                setattr(self, "_"+uni+"_uni", self._shader.getUniformPos(uni))

            self.reset()