diff --git a/blender/MapsModelsImporter/__init__.py b/blender/MapsModelsImporter/__init__.py index ec948e5..e5047bb 100644 --- a/blender/MapsModelsImporter/__init__.py +++ b/blender/MapsModelsImporter/__init__.py @@ -24,7 +24,7 @@ bl_info = { "name": "Maps Models Importer", "author": "Elie Michel", - "version": (0, 3, 0), + "version": (0, 3, 1), "blender": (2, 82, 0), "location": "File > Import > Google Maps Capture", "description": "Import meshes from a Google Maps or Google Earth capture", diff --git a/blender/MapsModelsImporter/google_maps.py b/blender/MapsModelsImporter/google_maps.py index 1c7bb44..136cfa9 100644 --- a/blender/MapsModelsImporter/google_maps.py +++ b/blender/MapsModelsImporter/google_maps.py @@ -88,6 +88,7 @@ def extractUniforms(constants, refMatrix): # Extract constants, which have different names depending on the browser/GPU driver globUniforms = constants['$Globals'] + postMatrix = None if '_w' in globUniforms and '_s' in globUniforms: [ou, ov, su, sv] = globUniforms['_w'] ov -= 1.0 / sv @@ -109,6 +110,16 @@ def extractUniforms(constants, refMatrix): matrix = makeMatrix(globUniforms['_uMeshToWorldMatrix']) matrix[3] = [0, 0, 0, 1] #matrix = makeMatrix(globUniforms['_uModelviewMatrix']) @ matrix + elif '_uMV' in globUniforms: + # Mapy CZ + uvOffsetScale = [0, -1, 1, -1] + matrix = makeMatrix(globUniforms['_uMV']) + postMatrix = Matrix( + ((0.682889997959137, 0.20221230387687683, 0.7019768357276917, -0.06431722640991211), + (0.07228320091962814, 0.9375065565109253, -0.3403771221637726, -0.11041564494371414), + (-0.7269363403320312, 0.28318125009536743, 0.6255972981452942, -1.349690556526184), + (0.0, 0.0, 0.0, 1.0)) + ) @ Matrix.Scale(500, 4) else: if refMatrix is None: print("globUniforms:") @@ -123,6 +134,9 @@ def extractUniforms(constants, refMatrix): refMatrix = Matrix.Rotation(-pi/2, 4, 'Y') @ matrix.inverted() matrix = refMatrix @ matrix + if postMatrix is not None: + matrix = postMatrix @ matrix + return uvOffsetScale, matrix, refMatrix def addMesh(context, name, verts, tris, uvs): diff --git a/blender/MapsModelsImporter/google_maps_rd.py b/blender/MapsModelsImporter/google_maps_rd.py index 6b6d93d..30d81bf 100644 --- a/blender/MapsModelsImporter/google_maps_rd.py +++ b/blender/MapsModelsImporter/google_maps_rd.py @@ -127,6 +127,11 @@ def extractRelevantCalls(self, drawcalls, _strategy=0): elif _strategy == 3: first_call = "glClear(Color = <0.000000, 0.000000, 0.000000, 1.000000>, Depth = <0.000000>, Stencil = <0x00>)" elif _strategy == 4: + first_call = "" + last_call = "ClearDepthStencilView" + 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 first_call = "DrawIndexed" last_call = "" @@ -135,11 +140,11 @@ def extractRelevantCalls(self, drawcalls, _strategy=0): skipped_drawcalls, min_drawcall = self.findDrawcallBatch(drawcalls, first_call, drawcall_prefix, last_call) if not skipped_drawcalls or not self.hasUniform(skipped_drawcalls[0], "_uProjModelviewMatrix"): first_call = "INVALID CASE, SKIP ME" - elif _strategy == 5: + elif _strategy == 6: first_call = "ClearRenderTargetView(0.000000, 0.000000, 0.000000" last_call = "Draw(4)" drawcall_prefix = "DrawIndexed" - elif _strategy == 6: + elif _strategy == 7: first_call = "" # Try from the beginning on last_call = "Draw(4)" drawcall_prefix = "DrawIndexed" @@ -157,6 +162,9 @@ def extractRelevantCalls(self, drawcalls, _strategy=0): if not relevant_drawcalls: return self.extractRelevantCalls(drawcalls, _strategy=_strategy+1) + if capture_type == "Mapy CZ" and not self.hasUniform(relevant_drawcalls[0], "_uMV"): + return self.extractRelevantCalls(drawcalls, _strategy=_strategy+1) + return relevant_drawcalls, capture_type def run(self):