File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,9 @@ private void writeNormalArray(TileModel model) throws IOException {
8787 writeString ("normal" );
8888 out .write (
8989 ATTRIBUTE_TYPE_FLOAT |
90- ATTRIBUTE_NOT_NORMALIZED |
90+ ATTRIBUTE_NORMALIZED |
9191 ATTRIBUTE_CARDINALITY_3D_VEC |
92- ATTRIBUTE_ENCODING_SIGNED_32BIT_FLOAT
92+ ATTRIBUTE_ENCODING_SIGNED_8BIT_INT
9393 );
9494
9595 writePadding ();
@@ -105,9 +105,9 @@ private void writeNormalArray(TileModel model) throws IOException {
105105 );
106106
107107 for (j = 0 ; j < 3 ; j ++) { // all 3 points
108- writeFloat (normal .x );
109- writeFloat (normal .y );
110- writeFloat (normal .z );
108+ writeNormalizedSignedByteValue (normal .x );
109+ writeNormalizedSignedByteValue (normal .y );
110+ writeNormalizedSignedByteValue (normal .z );
111111 }
112112 }
113113 }
@@ -283,6 +283,11 @@ private void writeFloat(float value) throws IOException {
283283 write4byteValue (Float .floatToIntBits (value ));
284284 }
285285
286+ private void writeNormalizedSignedByteValue (float value ) throws IOException {
287+ byte normalized = (byte ) (value * 0x80 - 0.5 );
288+ out .write (normalized & 0xFF );
289+ }
290+
286291 private void writeNormalizedUnsignedByteValue (float value ) throws IOException {
287292 int normalized = (int ) (value * 0xFF );
288293 out .write (normalized & 0xFF );
You can’t perform that action at this time.
0 commit comments