mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-04-22 13:49:57 +08:00
spec: Add connectivity_method == 0 to Sequential decoder
This addresses a comment in KhronosGroup/glTF#1114
This commit is contained in:
parent
71d0b9abe2
commit
d164943ee2
@ -55,11 +55,10 @@ void ParseSequentialIndicesUI32() {
|
||||
{:.draco-syntax }
|
||||
|
||||
|
||||
### DecodeSequentialConnectivityData()
|
||||
### DecodeSequentialIndices()
|
||||
|
||||
~~~~~
|
||||
void DecodeSequentialConnectivityData() {
|
||||
ParseSequentialConnectivityData();
|
||||
void DecodeSequentialIndices() {
|
||||
if (num_points < 256) {
|
||||
ParseSequentialIndicesUI8();
|
||||
} else if (num_points < (1 << 16)) {
|
||||
@ -70,3 +69,40 @@ void DecodeSequentialConnectivityData() {
|
||||
}
|
||||
~~~~~
|
||||
{:.draco-syntax }
|
||||
|
||||
|
||||
### DecodeSequentialCompressedIndices()
|
||||
|
||||
~~~~~
|
||||
void DecodeSequentialCompressedIndices() {
|
||||
DecodeSymbols(num_faces * 3, 1, &decoded_symbols);
|
||||
last_index_value = 0;
|
||||
for (i = 0; i < num_faces; ++i) {
|
||||
for (j = 0; j < 3; ++j) {
|
||||
encoded_val = decoded_symbols[i * 3 + j];
|
||||
index_diff = (encoded_val >> 1);
|
||||
if (encoded_val & 1)
|
||||
index_diff = -index_diff;
|
||||
val = index_diff + last_index_value;
|
||||
face_to_vertex[j][i] = val;
|
||||
last_index_value = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
{:.draco-syntax }
|
||||
|
||||
|
||||
### DecodeSequentialConnectivityData()
|
||||
|
||||
~~~~~
|
||||
void DecodeSequentialConnectivityData() {
|
||||
ParseSequentialConnectivityData();
|
||||
if (connectivity_method == 0) {
|
||||
DecodeSequentialCompressedIndices();
|
||||
} else if (connectivity_method == 1) {
|
||||
DecodeSequentialIndices();
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
{:.draco-syntax }
|
||||
|
Loading…
x
Reference in New Issue
Block a user