Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1871 (vertex colors not loaded in gltf models) #1873

Merged
merged 4 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,7 @@ public VertexBufferPopulator(VertexBuffer.Type bufferType) {
public VertexBuffer populate(Integer bufferViewIndex, int componentType, String type, int count,
int byteOffset, boolean normalized) throws IOException {
if (bufferType == null) {
logger.log(Level.WARNING,
"could not assign data to any VertexBuffer type for buffer view " + bufferViewIndex);
logger.log(Level.WARNING, "could not assign data to any VertexBuffer type for buffer view {0}", bufferViewIndex);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.jme3.scene.*;
import com.jme3.texture.Texture;
import com.jme3.util.*;

import java.io.*;
import java.nio.*;
import java.util.*;
Expand Down Expand Up @@ -384,19 +383,20 @@ public static float readAsFloat(LittleEndien stream, VertexBuffer.Format format)
// 5122 (SHORT) f = max(c / 32767.0, -1.0) c = round(f * 32767.0)
// 5123 (UNSIGNED_SHORT) f = c / 65535.0 c = round(f * 65535.0)
byte b;
int s;
Ali-RS marked this conversation as resolved.
Show resolved Hide resolved
switch (format) {
case Byte:
b = stream.readByte();
return Math.max(b / 127f, -1f);
case UnsignedByte:
b = stream.readByte();
return b / 255f;
s = stream.readUnsignedByte();
return s / 255f;
case Short:
b = stream.readByte();
return Math.max(b / 32767f, -1f);
s = stream.readShort();
return Math.max(s / 32767f, -1f);
case UnsignedShort:
b = stream.readByte();
return b / 65535f;
s = stream.readUnsignedShort();
return s / 65535f;
default:
//we have a regular float
return stream.readFloat();
Expand Down