Beispiel #1
0
 def __init__(self, context_identifier: str,
              resource_pack: OpenGLResourcePack):
     texture = resource_pack.get_atlas_id(context_identifier)
     TriMesh.__init__(self, context_identifier, texture)
     OpenGLResourcePackManager.__init__(self, resource_pack)
     self._camera_location: CameraLocationType = (0, 0, 0)
     self._rebuild()
Beispiel #2
0
    def __init__(self, context_identifier: str,
                 resource_pack: OpenGLResourcePack):
        OpenGLResourcePackManagerStatic.__init__(self, resource_pack)
        TriMesh.__init__(self, context_identifier,
                         resource_pack.get_atlas_id(context_identifier))
        self._points: numpy.ndarray = numpy.zeros(
            (2, 3), dtype=numpy.int)  # The points set using point1 and point2
        self._bounds: Optional[
            numpy.ndarray] = None  # The min and max locations
        self.transformation_matrix = numpy.eye(4, dtype=numpy.float64)
        self._rebuild = True
        self._volume = 1

        self._init_verts()
        self.draw_count = 36
        self._draw_mode = GL_TRIANGLES
Beispiel #3
0
    def __init__(
        self,
        rx: int,
        rz: int,
        region_size: int,
        context_identifier: str,
        resource_pack: OpenGLResourcePack,
    ):
        """A group of RenderChunks to minimise the number of draw calls"""
        super().__init__(context_identifier,
                         resource_pack.get_atlas_id(context_identifier))
        self.rx = rx
        self.rz = rz
        self._chunks: Dict[Tuple[int, int], RenderChunk] = {}
        self._merged_chunk_locations: Dict[Tuple[int, int],
                                           Tuple[int, int, int, int]] = {}
        self._manual_chunks: Dict[Tuple[int, int], RenderChunk] = {}

        self.region_transform = displacement_matrix(rx * region_size * 16, 0,
                                                    rz * region_size * 16)
    def __init__(
        self,
        rx: int,
        rz: int,
        region_size: int,
        context_identifier: str,
        resource_pack: OpenGLResourcePack,
    ):
        """A group of RenderChunks to minimise the number of draw calls"""
        super().__init__(context_identifier,
                         resource_pack.get_atlas_id(context_identifier))
        self.rx = rx
        self.rz = rz
        self._chunks: Dict[Tuple[int, int], RenderChunk] = {}
        self._merged_chunk_locations: Dict[Tuple[int, int],
                                           Tuple[int, int, int, int]] = {}
        self._manual_chunks: Dict[Tuple[int, int], RenderChunk] = {}

        self.region_transform = numpy.eye(4, dtype=numpy.float64)
        self.region_transform[3, [0, 2]] = numpy.array([rx, rz
                                                        ]) * region_size * 16
Beispiel #5
0
    def __init__(
        self,
        rx: int,
        rz: int,
        region_size: int,
        context_identifier: str,
        resource_pack: OpenGLResourcePack,
    ):
        """A group of RenderChunks to minimise the number of draw calls"""
        super().__init__(context_identifier,
                         resource_pack.get_atlas_id(context_identifier))
        self.rx = rx
        self.rz = rz
        self._chunks: Dict[Tuple[int, int], RenderChunk] = {}
        self._merged_chunk_locations: MergedChunkLocationsType = {}
        self._manual_chunks: Dict[Tuple[int, int], RenderChunk] = {}

        # Merging is done on a new thread which can't modify the opengl state.
        # This stores the created data and the main thread loads it when drawing.
        self._temp_data = None

        self.region_transform = displacement_matrix(rx * region_size * 16, 0,
                                                    rz * region_size * 16)
Beispiel #6
0
 def __init__(self, context_identifier: str, resource_pack: OpenGLResourcePack):
     texture = resource_pack.get_atlas_id(context_identifier)
     TriMesh.__init__(self, context_identifier, texture)
     OpenGLResourcePackManagerStatic.__init__(self, resource_pack)