Skip to content

Commit

Permalink
Handle cases where a google earth capture has only one batch of draw …
Browse files Browse the repository at this point in the history
…calls
  • Loading branch information
eliemichel committed Sep 17, 2020
1 parent 5725d8f commit 2113114
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blender/MapsModelsImporter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
bl_info = {
"name": "Maps Models Importer",
"author": "Elie Michel",
"version": (0, 3, 1),
"version": (0, 3, 2),
"blender": (2, 82, 0),
"location": "File > Import > Google Maps Capture",
"description": "Import meshes from a Google Maps or Google Earth capture",
Expand Down
20 changes: 15 additions & 5 deletions blender/MapsModelsImporter/google_maps_rd.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
_, CAPTURE_FILE, FILEPREFIX, MAX_BLOCKS_STR = sys.argv[:4]
MAX_BLOCKS = int(MAX_BLOCKS_STR)

# Start chrome with "chrome.exe --disable-gpu-sandbox --gpu-startup-dialog --use-angle=gl"

class CaptureScraper():
def __init__(self, controller):
self.controller = controller
Expand All @@ -51,7 +49,7 @@ def findDrawcallBatch(self, drawcalls, first_call_prefix, drawcall_prefix, last_
continue
batch.append(draw)
else:
print(f"Not relevant yet: {draw.name}")
print(f"Not relevant yet: {draw.name}")
if draw.name.startswith(first_call_prefix):
has_batch_started = True
if draw.name.startswith(drawcall_prefix):
Expand Down Expand Up @@ -132,7 +130,7 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
drawcall_prefix = "DrawIndexed"
capture_type = "Mapy CZ"
elif _strategy == 5:
# With Google Earth there are two batches of DrawIndexed calls, we are interested in the second one
# With Google Earth there are two batches of DrawIndexed calls, we are interested in the second one
first_call = "DrawIndexed"
last_call = ""
drawcall_prefix = "DrawIndexed"
Expand All @@ -141,10 +139,16 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
if not skipped_drawcalls or not self.hasUniform(skipped_drawcalls[0], "_uProjModelviewMatrix"):
first_call = "INVALID CASE, SKIP ME"
elif _strategy == 6:
# Actually sometimes there's only one batch
first_call = "DrawIndexed"
last_call = ""
drawcall_prefix = "DrawIndexed"
capture_type = "Google Earth (single)"
elif _strategy == 7:
first_call = "ClearRenderTargetView(0.000000, 0.000000, 0.000000"
last_call = "Draw(4)"
drawcall_prefix = "DrawIndexed"
elif _strategy == 7:
elif _strategy == 8:
first_call = "" # Try from the beginning on
last_call = "Draw(4)"
drawcall_prefix = "DrawIndexed"
Expand All @@ -165,6 +169,12 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
if capture_type == "Mapy CZ" and not self.hasUniform(relevant_drawcalls[0], "_uMV"):
return self.extractRelevantCalls(drawcalls, _strategy=_strategy+1)

if capture_type == "Google Earth (single)":
if not self.hasUniform(relevant_drawcalls[0], "_uMeshToWorldMatrix"):
return self.extractRelevantCalls(drawcalls, _strategy=_strategy+1)
else:
capture_type = "Google Earth"

return relevant_drawcalls, capture_type

def run(self):
Expand Down

0 comments on commit 2113114

Please sign in to comment.