CesiumGS / quantized-mesh

Specification for streaming massive terrain datasets for 3D visualization.
236 stars 41 forks source link

VertexData description does not specify delta encoding #2

Closed nitrologic closed 6 years ago

nitrologic commented 6 years ago

Reading the document in this repos and here there is no mention of the fact that u, v, and height arrays are both delta and zigzag encoded.

According to the source, it is evident that CesiumTerrainProvider interprets the values as deltas:

       var i;
        var u = 0;
        var v = 0;
        var height = 0;

        function zigZagDecode(value) {
            return (value >> 1) ^ (-(value & 1));
        }

        for (i = 0; i < vertexCount; ++i) {
            u += zigZagDecode(uBuffer[i]);
            v += zigZagDecode(vBuffer[i]);
            height += zigZagDecode(heightBuffer[i]);

            uBuffer[i] = u;
            vBuffer[i] = v;
            heightBuffer[i] = height;
        }
pjcozzi commented 6 years ago

Good eye, thanks @nitrologic! @tfili could you please make a spec "bug fix?"

tfili commented 6 years ago

Thanks @nitrologic. I've opened a PR to update the spec.