use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class StorageManagerTest method testPlayerRelevanceLocationSurvivesStorage.
@Test
public void testPlayerRelevanceLocationSurvivesStorage() {
Vector3f loc = new Vector3f(1, 2, 3);
character.addComponent(new LocationComponent(loc));
esm.waitForCompletionOfPreviousSaveAndStartSaving();
esm.finishSavingAndShutdown();
PlayerStore restored = esm.loadPlayerStore(PLAYER_ID);
assertEquals(loc, restored.getRelevanceLocation());
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class ByteCodeReflectFactoryTest method testCreateFieldAccessorWithGetterSetter.
@Test
public void testCreateFieldAccessorWithGetterSetter() throws Exception {
ReflectFactory reflectFactory = new ByteCodeReflectFactory();
FieldAccessor<GetterSetterComponent, Vector3f> fieldAccessor = reflectFactory.createFieldAccessor(GetterSetterComponent.class, GetterSetterComponent.class.getDeclaredField("value"), Vector3f.class);
GetterSetterComponent comp = new GetterSetterComponent();
Vector3f newVal = new Vector3f(1, 2, 3);
fieldAccessor.setValue(comp, newVal);
assertTrue(comp.setterUsed);
assertEquals(newVal, fieldAccessor.getValue(comp));
assertTrue(comp.getterUsed);
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class ChunkTest method testGetAabb.
@Test
public void testGetAabb() {
assertEquals(new Vector3f(0, 0, 0), chunk.getAABB().getMin());
assertEquals(new Vector3f(ChunkConstants.SIZE_X, ChunkConstants.SIZE_Y, ChunkConstants.SIZE_Z), chunk.getAABB().getMax());
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class LocationComponentTest method testParentRotatesWorldLocation.
@Test
public void testParentRotatesWorldLocation() {
LocationComponent parent = giveParent();
loc.setLocalPosition(pos1);
parent.setLocalRotation(yawRotation);
TeraAssert.assertEquals(new Vector3f(pos1.z, pos1.y, -pos1.x), loc.getWorldPosition(), 0.00001f);
}
use of org.terasology.math.geom.Vector3f in project Terasology by MovingBlocks.
the class LocationComponentTest method testScaleRotateAndOffsetCombineCorrectlyForWorldPosition.
@Test
public void testScaleRotateAndOffsetCombineCorrectlyForWorldPosition() {
LocationComponent parent = giveParent();
loc.setLocalPosition(pos1);
parent.setLocalScale(2.0f);
parent.setLocalPosition(pos2);
parent.setLocalRotation(yawRotation);
TeraAssert.assertEquals(new Vector3f(8, 7, 2), loc.getWorldPosition(), 0.00001f);
}
Aggregations