use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class ServerImpl method sendEntities.
private void sendEntities(NetData.NetMessage.Builder message) {
TIntIterator dirtyIterator = netDirty.iterator();
while (dirtyIterator.hasNext()) {
int netId = dirtyIterator.next();
EntityRef entity = networkSystem.getEntity(netId);
if (isOwned(entity)) {
Set<Class<? extends Component>> emptyComponentClassSet = Collections.emptySet();
EntityData.PackedEntity entityData = entitySerializer.serialize(entity, emptyComponentClassSet, changedComponents.get(netId), emptyComponentClassSet, new ClientComponentFieldCheck());
if (entityData != null) {
message.addUpdateEntity(NetData.UpdateEntityMessage.newBuilder().setEntity(entityData).setNetId(netId));
}
}
}
netDirty.clear();
}
use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class GLTFCommonFormat method loadBones.
protected List<Bone> loadBones(GLTF gltf, GLTFSkin skin, List<byte[]> loadedBuffers) {
List<Bone> bones = new ArrayList<>();
TIntIntMap boneToJoint = new TIntIntHashMap();
List<Matrix4f> inverseMats = loadInverseMats(skin.getInverseBindMatrices(), skin.getJoints().size(), gltf, loadedBuffers);
for (int i = 0; i < skin.getJoints().size(); i++) {
int nodeIndex = skin.getJoints().get(i);
GLTFNode node = gltf.getNodes().get(nodeIndex);
Vector3f position = new Vector3f();
Quaternionf rotation = new Quaternionf();
Vector3f scale = new Vector3f(1, 1, 1);
if (node.getTranslation() != null) {
position.set(node.getTranslation());
}
if (node.getRotation() != null) {
rotation.set(node.getRotation());
}
if (node.getScale() != null) {
scale.set(node.getScale());
}
String boneName = node.getName();
if (Strings.isNullOrEmpty(boneName)) {
boneName = "bone_" + i;
}
Bone bone = new Bone(i, boneName, new Matrix4f().translationRotateScale(position, rotation, scale));
bone.setInverseBindMatrix(inverseMats.get(i));
bones.add(bone);
boneToJoint.put(nodeIndex, i);
}
for (int i = 0; i < skin.getJoints().size(); i++) {
int nodeIndex = skin.getJoints().get(i);
GLTFNode node = gltf.getNodes().get(nodeIndex);
Bone bone = bones.get(i);
TIntIterator iterator = node.getChildren().iterator();
while (iterator.hasNext()) {
bone.addChild(bones.get(boneToJoint.get(iterator.next())));
}
}
return bones;
}
use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class TroveUtils method intToFloat.
public static TFloatList intToFloat(TIntList list) {
TFloatList result = new TFloatArrayList(list.size());
TIntIterator iterator = list.iterator();
while (iterator.hasNext()) {
int i = iterator.next();
result.add(i);
}
return result;
}
use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class TroveUtils method intToLong.
public static TLongList intToLong(TIntList list) {
TLongList result = new TLongArrayList(list.size());
TIntIterator iterator = list.iterator();
while (iterator.hasNext()) {
int i = iterator.next();
result.add(i);
}
return result;
}
use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class TroveUtils method intToDouble.
public static TDoubleList intToDouble(TIntList list) {
TDoubleList result = new TDoubleArrayList(list.size());
TIntIterator iterator = list.iterator();
while (iterator.hasNext()) {
int i = iterator.next();
result.add(i);
}
return result;
}
Aggregations