Added setting to display culling distance

This commit is contained in:
Khopa 2020-10-12 20:57:32 +02:00
parent 5a245bf362
commit 411e71b9a2
4 changed files with 20 additions and 0 deletions

View File

@ -421,6 +421,13 @@ class Game:
return False
return True
def get_culling_points(self):
"""
Check culling points
:return: List of culling points
"""
return self.__culling_points
# 1 = red, 2 = blue
def get_player_coalition_id(self):
return 2

View File

@ -56,6 +56,7 @@ class DisplayOptions:
detection_range = DisplayRule("SAM Detection Range", False)
map_poly = DisplayRule("Map Polygon Debug Mode", False)
waypoint_info = DisplayRule("Waypoint Information", True)
culling = DisplayRule("Display Culling Zones", False)
flight_paths = FlightPathOptions()
@classmethod

View File

@ -50,6 +50,7 @@ COLORS: Dict[str, QColor] = {
"green": QColor(128, 186, 128),
"light_green": QColor(223, 255, 173),
"light_green_transparent": QColor(180, 255, 140, 50),
"bright_green": QColor(64, 200, 64),
"black": QColor(0, 0, 0),

View File

@ -152,6 +152,17 @@ class QLiberationMap(QGraphicsView):
# text = scene.addText(str(r), font=QFont("Trebuchet MS", 10, weight=5, italic=False))
# text.setPos(0, i * 24)
# Display Culling
if DisplayOptions.culling and self.game.settings.perf_culling:
culling_points = self.game_model.game.get_culling_points()
culling_distance = self.game_model.game.settings.perf_culling_distance
for point in culling_points:
culling_distance_point = Point(point.x + culling_distance*1000, point.y + culling_distance*1000)
distance_point = self._transform_point(culling_distance_point)
transformed = self._transform_point(point)
diameter = distance_point[0] - transformed[0]
scene.addEllipse(transformed[0]-diameter/2, transformed[1]-diameter/2, diameter, diameter, CONST.COLORS["transparent"], CONST.COLORS["light_green_transparent"])
for cp in self.game.theater.controlpoints:
pos = self._transform_point(cp.position)