use of org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler in project Terasology by MovingBlocks.
the class TypeSerializationLibrary method createDefaultLibrary.
public static TypeSerializationLibrary createDefaultLibrary(ReflectFactory factory, CopyStrategyLibrary copyStrategies) {
TypeSerializationLibrary serializationLibrary = new TypeSerializationLibrary(factory, copyStrategies);
serializationLibrary.add(Color.class, new ColorTypeHandler());
serializationLibrary.add(Quat4f.class, new Quat4fTypeHandler());
serializationLibrary.add(Texture.class, new AssetTypeHandler<>(Texture.class));
serializationLibrary.add(UIElement.class, new AssetTypeHandler<>(UIElement.class));
serializationLibrary.add(Mesh.class, new AssetTypeHandler<>(Mesh.class));
serializationLibrary.add(StaticSound.class, new AssetTypeHandler<>(StaticSound.class));
serializationLibrary.add(StreamingSound.class, new AssetTypeHandler<>(StreamingSound.class));
serializationLibrary.add(Material.class, new AssetTypeHandler<>(Material.class));
serializationLibrary.add(Name.class, new NameTypeHandler());
serializationLibrary.add(SkeletalMesh.class, new AssetTypeHandler<>(SkeletalMesh.class));
serializationLibrary.add(MeshAnimation.class, new AssetTypeHandler<>(MeshAnimation.class));
serializationLibrary.add(TextureRegion.class, new TextureRegionTypeHandler());
serializationLibrary.add(TextureRegionAsset.class, new TextureRegionTypeHandler());
serializationLibrary.add(Vector4f.class, new Vector4fTypeHandler());
serializationLibrary.add(Vector3f.class, new Vector3fTypeHandler());
serializationLibrary.add(Vector2f.class, new Vector2fTypeHandler());
serializationLibrary.add(Vector3i.class, new Vector3iTypeHandler());
serializationLibrary.add(Vector2i.class, new Vector2iTypeHandler());
serializationLibrary.add(Rect2i.class, new Rect2iTypeHandler());
serializationLibrary.add(Rect2f.class, new Rect2fTypeHandler());
serializationLibrary.add(Region3i.class, new Region3iTypeHandler());
serializationLibrary.add(Prefab.class, new PrefabTypeHandler());
serializationLibrary.add(BehaviorTree.class, new AssetTypeHandler<>(BehaviorTree.class));
serializationLibrary.add(IntegerRange.class, new IntegerRangeHandler());
return serializationLibrary;
}
use of org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler in project Terasology by MovingBlocks.
the class ComponentSerializerTest method setup.
@Before
public void setup() {
context = new ContextImpl();
context.put(ModuleManager.class, moduleManager);
CoreRegistry.setContext(context);
TypeSerializationLibrary serializationLibrary = new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary);
serializationLibrary.add(Vector3f.class, new Vector3fTypeHandler());
serializationLibrary.add(Quat4f.class, new Quat4fTypeHandler());
NetworkSystem networkSystem = mock(NetworkSystem.class);
context.put(NetworkSystem.class, networkSystem);
EntitySystemSetupUtil.addReflectionBasedLibraries(context);
EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
EngineEntityManager entityManager = context.get(EngineEntityManager.class);
entityManager.getComponentLibrary().register(new SimpleUri("test", "gettersetter"), GetterSetterComponent.class);
entityManager.getComponentLibrary().register(new SimpleUri("test", "string"), StringComponent.class);
entityManager.getComponentLibrary().register(new SimpleUri("test", "integer"), IntegerComponent.class);
ComponentLibrary componentLibrary = entityManager.getComponentLibrary();
componentSerializer = new ComponentSerializer(componentLibrary, serializationLibrary);
}
use of org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler in project Terasology by MovingBlocks.
the class PojoPrefabManagerTest method setup.
@Before
public void setup() throws Exception {
ContextImpl context = new ContextImpl();
CoreRegistry.setContext(context);
ModuleManager moduleManager = ModuleManagerFactory.create();
ReflectFactory reflectFactory = new ReflectionReflectFactory();
CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory);
TypeSerializationLibrary lib = new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary);
lib.add(Vector3f.class, new Vector3fTypeHandler());
lib.add(Quat4f.class, new Quat4fTypeHandler());
entitySystemLibrary = new EntitySystemLibrary(context, lib);
componentLibrary = entitySystemLibrary.getComponentLibrary();
ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager();
assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs");
assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
context.put(AssetManager.class, assetTypeManager.getAssetManager());
prefabManager = new PojoPrefabManager(context);
}
Aggregations