Skip to content

Commit

Permalink
GltfLoader: copyedits to 18 inline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Oct 1, 2023
1 parent 230f157 commit 68c4271
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected Object loadFromStream(AssetInfo assetInfo, InputStream stream) throws

setupControls();

// only one scene let's not return the root.
// only one scene, let's not return the root.
if (rootNode.getChildren().size() == 1) {
Node child = (Node) rootNode.getChild(0);
// Migrate lights that were in the parent to the child.
Expand Down Expand Up @@ -196,7 +196,7 @@ private boolean isSupported(String version, String minVersion) {

public void readScenes(JsonPrimitive defaultScene, Node rootNode) throws IOException {
if (scenes == null) {
// no scene... lets handle this later...
// no scene... let's handle this later...
throw new AssetLoadException("Gltf files with no scene is not yet supported");
}

Expand Down Expand Up @@ -231,7 +231,7 @@ public Object readNode(int nodeIndex) throws IOException {
Object obj = fetchFromCache("nodes", nodeIndex, Object.class);
if (obj != null) {
if (obj instanceof JointWrapper) {
// the node can be a previously loaded bone let's return it
// the node can be a previously loaded bone, let's return it
return obj;
} else {
// If a spatial is referenced several times, it may be attached to different parents,
Expand Down Expand Up @@ -332,12 +332,12 @@ public Transform readTransforms(JsonObject nodeData) {
for (int i = 0; i < tmpArray.length; i++) {
tmpArray[i] = matrix.get(i).getAsFloat();
}
// creates a row major matrix from color major data
// creates a row-major matrix from column-major data
Matrix4f mat = new Matrix4f(tmpArray);
transform.fromTransformMatrix(mat);
return transform;
}
// no matrix transforms: no transforms or transforms givens as translation/rotation/scale
// no matrix transforms: no transforms or transforms given as translation/rotation/scale
JsonArray translation = nodeData.getAsJsonArray("translation");
if (translation != null) {
transform.setTranslation(
Expand Down Expand Up @@ -421,9 +421,9 @@ public Geometry[] readMeshPrimitives(int meshIndex) throws IOException {
handleSkinningBuffers(mesh, skinBuffers);

if (mesh.getBuffer(VertexBuffer.Type.BoneIndex) != null) {
// the mesh has some skinning let's create needed buffers for HW skinning
// the mesh has some skinning, let's create needed buffers for HW skinning
// creating empty buffers for HW skinning
// the buffers will be setup if ever used.
// the buffers will be set up if ever used.
VertexBuffer weightsHW = new VertexBuffer(VertexBuffer.Type.HWBoneWeight);
VertexBuffer indicesHW = new VertexBuffer(VertexBuffer.Type.HWBoneIndex);
// setting usage to cpuOnly so that the buffer is not sent empty to the GPU
Expand Down Expand Up @@ -480,7 +480,7 @@ public Geometry[] readMeshPrimitives(int meshIndex) throws IOException {
geom.setQueueBucket(RenderQueue.Bucket.Transparent);
}
if (useNormalsFlag && mesh.getBuffer(VertexBuffer.Type.Tangent) == null) {
// No tangent buffer, but there is a normal map, we have to generate them using MiiktSpace
// No tangent buffer, but there is a normal map, we have to generate them using MikktSpace
MikktspaceTangentGenerator.generate(geom);
}
}
Expand Down Expand Up @@ -605,7 +605,7 @@ protected byte[] getBytes(int bufferIndex, String uri, Integer bufferLength) thr
dataStream.close();
}
} else {
// no URI this should not happen in a gltf file, only in glb files.
// no URI, this should not happen in a gltf file, only in glb files.
throw new AssetLoadException("Buffer " + bufferIndex + " has no uri");
}
return data;
Expand Down Expand Up @@ -938,9 +938,9 @@ public void readAnimation(int animationIndex) throws IOException {
}
}

// Check each bone to see if their local pose is different from their bind pose.
// Check each bone to see if its local pose is different from its bind pose.
// If it is, we ensure that the bone has an animation track,
// else JME way of applying anim transforms will apply the bind pose to those bones,
// else the JME way of applying anim transforms will apply the bind pose to those bones,
// instead of the local pose that is supposed to be the default
if (skinIndex != -1) {
SkinData skin = fetchFromCache("skins", skinIndex, SkinData.class);
Expand Down Expand Up @@ -970,7 +970,7 @@ public void readAnimation(int animationIndex) throws IOException {
if (!spatials.isEmpty()) {
if (skinIndex != -1) {
// there are some spatial or morph tracks in this bone animation... or the other way around.
// Let's add the spatials in the skinnedSpatials.
// Let's add the spatials to the skinnedSpatials.
SkinData skin = fetchFromCache("skins", skinIndex, SkinData.class);
List<Spatial> spat = skinnedSpatials.get(skin);
spat.addAll(spatials);
Expand Down Expand Up @@ -1034,7 +1034,7 @@ public void readSkins() throws IOException {
JsonObject skin = skins.get(index).getAsJsonObject();

// Note that the "skeleton" index is intentionally ignored.
// It's not mandatory and exporters tends to mix up how it should be used
// It's not mandatory and exporters tend to mix up how it should be used
// because the specs are not clear.
// Anyway we have other means to detect both armature structures and root bones.

Expand Down Expand Up @@ -1349,7 +1349,7 @@ public float[] populate(Integer bufferViewIndex, int componentType, String type,
float[] data = new float[dataSize];

if (bufferViewIndex == null) {
// no referenced buffer, specs says to pad the data with zeros.
// no referenced buffer, specs say to pad the data with zeros.
padBuffer(data, dataSize);
} else {
readBuffer(bufferViewIndex, byteOffset, count, data, numComponents,
Expand All @@ -1371,7 +1371,7 @@ public float[] populate(Integer bufferViewIndex, int componentType, String type,
// float[] data = new float[dataSize];
//
// if (bufferViewIndex == null) {
// // no referenced buffer, specs says to pad the data with zeros.
// // no referenced buffer, specs say to pad the data with zeros.
// padBuffer(data, dataSize);
// } else {
// readBuffer(bufferViewIndex, byteOffset, count, data, numComponents,
Expand All @@ -1393,7 +1393,7 @@ public Vector3f[] populate(Integer bufferViewIndex, int componentType, String ty
Vector3f[] data = new Vector3f[count];

if (bufferViewIndex == null) {
// no referenced buffer, specs says to pad the data with zeros.
// no referenced buffer, specs say to pad the data with zeros.
padBuffer(data, dataSize);
} else {
readBuffer(bufferViewIndex, byteOffset, count, data, numComponents,
Expand All @@ -1413,7 +1413,7 @@ public Quaternion[] populate(Integer bufferViewIndex, int componentType, String
Quaternion[] data = new Quaternion[count];

if (bufferViewIndex == null) {
// no referenced buffer, specs says to pad the data with zeros.
// no referenced buffer, specs say to pad the data with zeros.
padBuffer(data, dataSize);
} else {
readBuffer(bufferViewIndex, byteOffset, count, data, numComponents,
Expand Down Expand Up @@ -1462,7 +1462,7 @@ public SkinBuffers populate(Integer bufferViewIndex, int componentType, String t
short[] data = new short[dataSize];

if (bufferViewIndex == null) {
// no referenced buffer, specs says to pad the data with zeros.
// no referenced buffer, specs say to pad the data with zeros.
padBuffer(data, dataSize);
} else {
readBuffer(bufferViewIndex, byteOffset, count, data, numComponents, format);
Expand Down

0 comments on commit 68c4271

Please sign in to comment.