Bump engine submodule.
This commit is contained in:
		
							
								
								
									
										2
									
								
								engine
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								engine
									
									
									
									
									
								
							 Submodule engine updated: d0741afda7...a5adfacdfd
									
								
							@ -13,14 +13,14 @@
 | 
				
			|||||||
# You should have received a copy of the GNU Affero General Public License
 | 
					# You should have received a copy of the GNU Affero General Public License
 | 
				
			||||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
					# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ctypes import c_ubyte, c_uint, c_void_p, POINTER, addressof
 | 
					from ctypes import c_ubyte, c_ushort, c_void_p, POINTER, addressof
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from engine import (
 | 
					from engine import (
 | 
				
			||||||
    buffer, INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, param_type, params_format,
 | 
					    buffer, INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, param_type, params_format,
 | 
				
			||||||
    create_batch, fill_batch, draw_batch, destroy_batch)
 | 
					    create_batch, fill_batch, draw_batch, destroy_batch)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_c_ubyte_p = POINTER(c_ubyte)
 | 
					_flags_p = POINTER(c_ubyte)
 | 
				
			||||||
_c_uint_p = POINTER(c_uint)
 | 
					_mesh_p = POINTER(c_ushort)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Batch:
 | 
					class Batch:
 | 
				
			||||||
    __slots__ = ('_batch', 'vertices', 'max_size', 'size',
 | 
					    __slots__ = ('_batch', 'vertices', 'max_size', 'size',
 | 
				
			||||||
@ -37,9 +37,9 @@ class Batch:
 | 
				
			|||||||
        self.max_size = max_size
 | 
					        self.max_size = max_size
 | 
				
			||||||
        self.size = 0
 | 
					        self.size = 0
 | 
				
			||||||
        self.flags = buffer(c_ubyte, max_size)
 | 
					        self.flags = buffer(c_ubyte, max_size)
 | 
				
			||||||
        self._flags = _c_ubyte_p(self.flags)
 | 
					        self._flags = _flags_p(self.flags)
 | 
				
			||||||
        self.mesh = buffer(c_uint, max_size)
 | 
					        self.mesh = buffer(c_ushort, max_size)
 | 
				
			||||||
        self._meshes = _c_uint_p(self.mesh)
 | 
					        self._meshes = _mesh_p(self.mesh)
 | 
				
			||||||
        if nparams:
 | 
					        if nparams:
 | 
				
			||||||
            self.param = tuple(map(lambda f: buffer(param_type(f), max_size), params_decls.values()))
 | 
					            self.param = tuple(map(lambda f: buffer(param_type(f), max_size), params_decls.values()))
 | 
				
			||||||
            self._params = (c_void_p * nparams)(*map(addressof, self.param))
 | 
					            self._params = (c_void_p * nparams)(*map(addressof, self.param))
 | 
				
			||||||
@ -66,9 +66,9 @@ class Batch:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def freeze(self, flags = None, mesh = None, **params):
 | 
					    def freeze(self, flags = None, mesh = None, **params):
 | 
				
			||||||
        if flags is not None:
 | 
					        if flags is not None:
 | 
				
			||||||
            self._flags = None if flags else _c_ubyte_p(self.flags)
 | 
					            self._flags = None if flags else _flags_p(self.flags)
 | 
				
			||||||
        if mesh is not None:
 | 
					        if mesh is not None:
 | 
				
			||||||
            self._meshes = None if mesh else _c_uint_p(self.mesh)
 | 
					            self._meshes = None if mesh else _mesh_p(self.mesh)
 | 
				
			||||||
        for name, value in params.items():
 | 
					        for name, value in params.items():
 | 
				
			||||||
            if value is not None:
 | 
					            if value is not None:
 | 
				
			||||||
                index = self._name[name]
 | 
					                index = self._name[name]
 | 
				
			||||||
 | 
				
			|||||||
@ -139,7 +139,7 @@ class TextureData:
 | 
				
			|||||||
        _write_blob(file, self.pixels)
 | 
					        _write_blob(file, self.pixels)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class VerticesData:
 | 
					class VerticesData:
 | 
				
			||||||
    __slots__ = 'name', 'vertices', 'indices', 'meshes'
 | 
					    __slots__ = 'name', 'vertices', 'indices', 'meshes', 'meshes_db'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, name, vertices, indices, meshes):
 | 
					    def __init__(self, name, vertices, indices, meshes):
 | 
				
			||||||
        if len(vertices) % VERTEX_SIZE != 0:
 | 
					        if len(vertices) % VERTEX_SIZE != 0:
 | 
				
			||||||
@ -147,17 +147,18 @@ class VerticesData:
 | 
				
			|||||||
        self.name = name
 | 
					        self.name = name
 | 
				
			||||||
        self.vertices = vertices
 | 
					        self.vertices = vertices
 | 
				
			||||||
        self.indices = indices
 | 
					        self.indices = indices
 | 
				
			||||||
        self.meshes = meshes
 | 
					        self.meshes = array('I', meshes.values())
 | 
				
			||||||
 | 
					        self.meshes_db = dict(zip(meshes.keys(), range(len(meshes))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __iter__(self):
 | 
					    def __iter__(self):
 | 
				
			||||||
        yield VERTEX_FORMAT
 | 
					        yield VERTEX_FORMAT
 | 
				
			||||||
        yield len(self.vertices) // VERTEX_SIZE
 | 
					        yield len(self.vertices) // VERTEX_SIZE
 | 
				
			||||||
        yield self.vertices
 | 
					        yield self.vertices
 | 
				
			||||||
        yield self.indices
 | 
					        yield self.indices
 | 
				
			||||||
        yield array('I', self.meshes.values())
 | 
					        yield self.meshes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_mesh(self, name):
 | 
					    def get_mesh(self, name):
 | 
				
			||||||
        return self.meshes[name]
 | 
					        return self.meshes_db[name]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def from_archive(cls, file):
 | 
					    def from_archive(cls, file):
 | 
				
			||||||
@ -176,8 +177,8 @@ class VerticesData:
 | 
				
			|||||||
        _write_struct(file, 'III', len(self.vertices) // VERTEX_SIZE, len(self.indices), len(self.meshes))
 | 
					        _write_struct(file, 'III', len(self.vertices) // VERTEX_SIZE, len(self.indices), len(self.meshes))
 | 
				
			||||||
        _write_array(file, self.vertices)
 | 
					        _write_array(file, self.vertices)
 | 
				
			||||||
        _write_array(file, self.indices)
 | 
					        _write_array(file, self.indices)
 | 
				
			||||||
        _write_array(file, array('I', self.meshes.values()))
 | 
					        _write_array(file, self.meshes)
 | 
				
			||||||
        for name in self.meshes.keys():
 | 
					        for name in self.meshes_db.keys():
 | 
				
			||||||
            _write_string(file, name)
 | 
					            _write_string(file, name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Archive:
 | 
					class Archive:
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user