Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Is this information still relevant? #34

Closed
lewa-j opened this issue Aug 28, 2019 · 4 comments
Closed

Is this information still relevant? #34

lewa-j opened this issue Aug 28, 2019 · 4 comments

Comments

@lewa-j
Copy link

lewa-j commented Aug 28, 2019

I tried to decode the mesh using the information from Readme.md, as well as dump_obj.js, but nothing worked. It seems to me that during this time, the layout of the mesh vertices has changed.
I've tried node https://kh.google.com/rt/earth/NodeData/pb=!1m2!1s214272516372616353!2u852!2e1!4b0
There are 3 mesh in this file. Each of them contains 18744, 3678 and 1809 bytes of vertices. Second and third not even a multiple of 8.

@retroplasma
Copy link
Owner

retroplasma commented Sep 2, 2019

it is still working:

node dump_obj.js 214272516372616353 20
image

one level up:

node dump_obj.js 21427251637261635 20
image

edit: Is that helpful or are you trying to do something else?

@lewa-j
Copy link
Author

lewa-j commented Sep 3, 2019

I am trying to do the same in C#. Maybe proto files in the repository are not the same as those used in js?

@retroplasma
Copy link
Owner

retroplasma commented Sep 3, 2019

The proto in this repo is incomplete; here is one with more detail which only lacks NodeData field 8. The vertices byte array straight from the proto (field 1) is a multiple of 3; it only contains XYZ. A vertex buffer is created with a count divisible by 8 from XYZ, UV (field 7) and layer/octant-counts (field 8).

XYZ processing works ~ like this:

var count = input.length / 3;
var output = new Uint8Array(8 * count);
for (var i = 0, axis = 0; axis < 3; axis++) {       
  for (var j = 0, d = 0; j < count; j++) {
    d = (d + input[i++]) & 0xFF;
    output[8 * j + axis] = d;
  }
}

Unfortunately I didn't have time yet to make this stuff transparent.

@lewa-j
Copy link
Author

lewa-j commented Sep 3, 2019

Many thanks! This is exactly what I was missing. From README.md it seemed that XYZWUUVV was exactly the format of the vertices field.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants