在 Sceneform 1.16.0 下,由于其计数始终为零,因此无法访问GLTF / GLB文件中的子网格或材料信息。
关于这现在是Google的开源项目(并且已被归档的废弃项目),可以检查Renderable类的代码,以便找出问题的出处。
这将我们带到构造函数:
@SuppressWarnings("initialization")
protected Renderable(Renderable other) {
if (other.getId().isEmpty()) {
throw new AssertionError("Cannot copy uninitialized Renderable.");
}
// Share renderableData with the original Renderable.
renderableData = other.renderableData;
// Copy materials.
Preconditions.checkState(other.materialNames.size() == other.materialBindings.size());
for (int i = 0; i < other.materialBindings.size(); i++) {
Material otherMaterial = other.materialBindings.get(i);
materialBindings.add(otherMaterial.makeCopy());
materialNames.add(other.materialNames.get(i));
}
renderPriority = other.renderPriority;
isShadowCaster = other.isShadowCaster;
isShadowReceiver = other.isShadowReceiver;
// Copy collision shape.
if (other.collisionShape != null) {
collisionShape = other.collisionShape.makeCopy();
}
changeId.update();
}
......原始Renderable( other )的子网格(other.renderableData)和材料(other.materialBindings)的数量为零。
对此有任何帮助吗?
最诚挚的问候。