Skip to content

Commit 0f8a309

Browse files
authored
Update VertexBuffer: modify getName() method + javadoc
1 parent d1c8521 commit 0f8a309

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ public void read(JmeImporter im) throws IOException {
11681168
stride = ic.readInt("stride", 0);
11691169
instanceSpan = ic.readInt("instanceSpan", 0);
11701170
name = ic.readString("name", null);
1171-
1171+
11721172
componentsLength = components * format.getComponentSize();
11731173

11741174
String dataName = "data" + format.name();
@@ -1194,14 +1194,28 @@ public void read(JmeImporter im) throws IOException {
11941194
}
11951195
}
11961196

1197+
/**
1198+
* Returns the name of this `VertexBuffer`. If no name has been explicitly
1199+
* set, a default name is generated based on its class name and buffer type
1200+
* (e.g., "VertexBuffer(Position)").
1201+
*
1202+
* @return The name of the `VertexBuffer`.
1203+
*/
11971204
public String getName() {
11981205
if (name == null) {
1199-
name = getClass().getSimpleName() + "(" + getBufferType().name() + ")";
1206+
return String.format("%s(%s)", getClass().getSimpleName(), getBufferType().name());
12001207
}
12011208
return name;
12021209
}
12031210

1211+
/**
1212+
* Sets a custom name for this `VertexBuffer`.
1213+
*
1214+
* @param name The new name for the `VertexBuffer`. Can be null to revert
1215+
* to the default generated name.
1216+
*/
12041217
public void setName(String name) {
12051218
this.name = name;
12061219
}
1220+
12071221
}

0 commit comments

Comments
 (0)