com.badlogic.gdx.utils.LongMap Java Examples

The following examples show how to use com.badlogic.gdx.utils.LongMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelFactory.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
private static Material getMaterial (ModelMesh modelMesh, Texture texture, String textureName) {
	Material m = null;

	long materialHash = Hash.RSHash(modelMesh.toString() + textureName);
	if (cachedMaterials == null) {
		cachedMaterials = new LongMap<Material>();
	}

	if (cachedMaterials.containsKey(materialHash)) {
		return cachedMaterials.get(materialHash);
	} else {
		TextureAttribute ta = new TextureAttribute(texture, 0, "u_texture");
		m = new Material("default", ta);
		cachedMaterials.put(materialHash, m);
	}

	return m;
}
 
Example #2
Source File: ModelFactory.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private static StillModel getStillModel (String model) {
	StillModel m = null;
	long modelHash = Hash.RSHash(model);

	if (cachedStillModels == null) {
		cachedStillModels = new LongMap<StillModel>();
	}

	if (cachedStillModels.containsKey(modelHash)) {
		return cachedStillModels.get(modelHash);
	} else {
		try {
			String[] ext = model.split("\\.");

			if (ext[1].equals("g3dt")) {
				// NO opengl coords, NO invert v
				InputStream in = Gdx.files.internal(model).read();
				m = G3dtLoader.loadStillModel(in, true);
				in.close();
			} else if (ext[1].equals("obj")) {
				// y-forward, z-up
				// ObjLoader l = new ObjLoader();
				// m = l.loadObj(Gdx.files.internal(model), true);
				Gdx.app.log("ModelFactory", "Attention, ignoring deprecated OBJ model!");
			}

			cachedStillModels.put(modelHash, m);
		} catch (IOException ioex) {
			Gdx.app.log("ModelFactory", ioex.getMessage());
		}
	}

	return m;
}
 
Example #3
Source File: Engine.java    From GdxDemo3D with Apache License 2.0 4 votes vote down vote up
public Engine(){
	entities = new Array<Entity>(false, 16);
	entitiesById = new LongMap<Entity>();
}