com.badlogic.gdx.utils.ArrayMap Java Examples
The following examples show how to use
com.badlogic.gdx.utils.ArrayMap.
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: NavMeshGraph.java From GdxDemo3D with Apache License 2.0 | 6 votes |
/** * Creates a map over each triangle and its Edge connections to other triangles. Each edge must follow the * vertex winding order of the triangle associated with it. Since all triangles are assumed to have the same * winding order, this means if two triangles connect, each must have its own edge connection data, where the * edge follows the same winding order as the triangle which owns the edge data. * * @param indexConnections * @param triangles * @param vertexVectors * @return */ private static ArrayMap<Triangle, Array<Edge>> createSharedEdgesMap( Array<IndexConnection> indexConnections, Array<Triangle> triangles, Vector3[] vertexVectors) { ArrayMap<Triangle, Array<Edge>> connectionMap = new ArrayMap<Triangle, Array<Edge>>(); connectionMap.ordered = true; for (Triangle tri : triangles) { connectionMap.put(tri, new Array<Edge>()); } for (IndexConnection i : indexConnections) { Triangle fromNode = triangles.get(i.fromTriIndex); Triangle toNode = triangles.get(i.toTriIndex); Vector3 edgeVertexA = vertexVectors[i.edgeVertexIndex1]; Vector3 edgeVertexB = vertexVectors[i.edgeVertexIndex2]; Edge edge = new Edge(fromNode, toNode, edgeVertexA, edgeVertexB); connectionMap.get(fromNode).add(edge); fromNode.connections.add(edge); } return connectionMap; }
Example #2
Source File: ViewController.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
public static WorldObjectView createView(Player viewer, PlayerColors colors, WorldObject object) { WorldObjectView view = new WorldObjectView(); ArrayMap<Object, SubView> subViewArrayMap = object.createSubViews(viewer, colors); for (Object key : subViewArrayMap.keys()) { view.addSubView(key, subViewArrayMap.get(key)); } object.initView(view); return view; }
Example #3
Source File: HeadlessModel.java From gdx-proto with Apache License 2.0 | 5 votes |
private void loadNodes (Iterable<ModelNode> modelNodes) { nodePartBones.clear(); for (ModelNode node : modelNodes) { nodes.add(loadNode(null, node)); } for (ObjectMap.Entry<NodePart, ArrayMap<String, Matrix4>> e : nodePartBones.entries()) { if (e.key.invBoneBindTransforms == null) e.key.invBoneBindTransforms = new ArrayMap<Node, Matrix4>(Node.class, Matrix4.class); e.key.invBoneBindTransforms.clear(); for (ObjectMap.Entry<String, Matrix4> b : e.value.entries()) e.key.invBoneBindTransforms.put(getNode(b.key), new Matrix4(b.value).inv()); } }
Example #4
Source File: NavMeshGraph.java From GdxDemo3D with Apache License 2.0 | 5 votes |
/** * Map the isolated edges for each triangle which does not have all three edges connected to other triangles. * * @param connectionMap * @return */ private static ArrayMap<Triangle, Array<Edge>> createIsolatedEdgesMap(ArrayMap<Triangle, Array<Edge>> connectionMap) { ArrayMap<Triangle, Array<Edge>> disconnectionMap = new ArrayMap<Triangle, Array<Edge>>(); for (int i = 0; i < connectionMap.size; i++) { Triangle tri = connectionMap.getKeyAt(i); Array<Edge> connectedEdges = connectionMap.getValueAt(i); Array<Edge> disconnectedEdges = new Array<Edge>(); disconnectionMap.put(tri, disconnectedEdges); if (connectedEdges.size < 3) { // This triangle does not have all edges connected to other triangles boolean ab = true; boolean bc = true; boolean ca = true; for (Edge edge : connectedEdges) { if (edge.rightVertex == tri.a && edge.leftVertex == tri.b) ab = false; else if (edge.rightVertex == tri.b && edge.leftVertex == tri.c) bc = false; else if (edge.rightVertex == tri.c && edge.leftVertex == tri.a) ca = false; } if (ab) disconnectedEdges.add(new Edge(tri, null, tri.a, tri.b)); if (bc) disconnectedEdges.add(new Edge(tri, null, tri.b, tri.c)); if (ca) disconnectedEdges.add(new Edge(tri, null, tri.c, tri.a)); } int totalEdges = (connectedEdges.size + disconnectedEdges.size); if (totalEdges != 3) { Gdx.app.debug(TAG, "Wrong number of edges (" + totalEdges + ") in triangle " + tri.getIndex()); } } return disconnectionMap; }
Example #5
Source File: Utils.java From gdx-facebook with Apache License 2.0 | 5 votes |
public static ArrayMap<String, String> parseQuery(String query) throws UnsupportedEncodingException { ArrayMap<String, String> params = new ArrayMap<String, String>(); for (String param : query.split("&")) { String[] pair = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = URLDecoder.decode(pair[1], "UTF-8"); params.put(key, value); } return params; }
Example #6
Source File: UtilsUnitTests.java From gdx-facebook with Apache License 2.0 | 5 votes |
@Test public void parseQueryTest() { try { ArrayMap<String, String> result = Utils.parseQuery("access_token=CAAqyZEeY&expires_in=5182959"); assertEquals("access_token", result.getKeyAt(0)); assertEquals("CAAqyZEeY", result.getValueAt(0)); assertEquals("expires_in", result.getKeyAt(1)); assertEquals("5182959", result.getValueAt(1)); } catch (UnsupportedEncodingException e) { } }
Example #7
Source File: ViewController.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
public static void updateView(Player viewer, PlayerColors colors, WorldObject object, WorldObjectView view) { view.clearChildren(); ArrayMap<Object, SubView> subViewArrayMap = object.createSubViews(viewer, colors); for (Object key : subViewArrayMap.keys()) { view.addSubView(key, subViewArrayMap.get(key)); } }
Example #8
Source File: SkinLoader.java From gdx-gltf with Apache License 2.0 | 5 votes |
private void load(GLTFSkin glSkin, GLTFNode glNode, Node node, NodeResolver nodeResolver, DataResolver dataResolver){ Array<Matrix4> ibms = new Array<Matrix4>(); Array<Integer> joints = new Array<Integer>(); int bonesCount = glSkin.joints.size; FloatBuffer floatBuffer = dataResolver.getBufferFloat(glSkin.inverseBindMatrices); for(int i=0 ; i<bonesCount ; i++){ float [] matrixData = new float[16]; floatBuffer.get(matrixData); ibms.add(new Matrix4(matrixData)); } joints.addAll(glSkin.joints); if(ibms.size > 0){ for(NodePart nodePart : node.parts){ nodePart.bones = new Matrix4[ibms.size]; nodePart.invBoneBindTransforms = new ArrayMap<Node, Matrix4>(); for(int n=0 ; n<joints.size ; n++){ nodePart.bones[n] = new Matrix4().idt(); int nodeIndex = joints.get(n); Node key = nodeResolver.get(nodeIndex); if(key == null) throw new GLTFIllegalException("node not found for bone: " + nodeIndex); nodePart.invBoneBindTransforms.put(key, ibms.get(n)); } } } }
Example #9
Source File: WorldObject.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
public ArrayMap<Object, SubView> createSubViews(Player viewer, PlayerColors colors) { ArrayMap<Object, SubView> result = new ArrayMap<Object, SubView>(); result.put(this, new ImageSubView(worldObjectName)); return result; }
Example #10
Source File: GDXFacebookMultiPartRequest.java From gdx-facebook with Apache License 2.0 | 4 votes |
@Override public ArrayMap<String, String> getHeaders() { return headers; }
Example #11
Source File: GDXFacebookMultiPartRequest.java From gdx-facebook with Apache License 2.0 | 4 votes |
@Override public GDXFacebookMultiPartRequest putFields(ArrayMap<String, String> fields) { return (GDXFacebookMultiPartRequest) super.putFields(fields); }
Example #12
Source File: GDXFacebookGraphRequest.java From gdx-facebook with Apache License 2.0 | 4 votes |
@Override public final ArrayMap<String, String> getHeaders() { return null; }
Example #13
Source File: GDXFacebookGraphRequest.java From gdx-facebook with Apache License 2.0 | 4 votes |
@Override public GDXFacebookGraphRequest putFields(ArrayMap<String, String> fields) { return (GDXFacebookGraphRequest) super.putFields(fields); }
Example #14
Source File: Obstacle.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
@Override public ArrayMap<Object, SubView> createSubViews(Player viewer, PlayerColors colors) { ArrayMap<Object, SubView> result = new ArrayMap<Object, SubView>(); result.put(this, new ImageSubView("obstacle/" + worldObjectName)); return result; }
Example #15
Source File: StepDetector.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
@Override public ArrayMap<Object, SubView> createSubViews(Player viewer, PlayerColors colors) { ArrayMap<Object, SubView> result = new ArrayMap<Object, SubView>(); result.put(this, new StepDetectorSubView(this)); return result; }
Example #16
Source File: CCSimpleAudioEngine.java From cocos2d-java with MIT License | 4 votes |
/**The shared sound effect list. The key is the hashcode of the file path.*/ public static ArrayMap<Integer, CCEffectPlayer> sharedList() { return (s_List); }
Example #17
Source File: Toggleable.java From gdx-proto with Apache License 2.0 | 4 votes |
public static void init() { list = new ArrayMap<>(); loadFromPrefs(); }
Example #18
Source File: AbstractRequest.java From gdx-facebook with Apache License 2.0 | 2 votes |
/** * Add multiple fields to the request. * * @param fields * @return this */ public AbstractRequest putFields(ArrayMap<String, String> fields) { fields.putAll(fields); return this; }
Example #19
Source File: AbstractRequest.java From gdx-facebook with Apache License 2.0 | 2 votes |
/** * Returns all fields added to the fields * * @return fields */ public ArrayMap<String, String> getFields() { return fields; }
Example #20
Source File: Request.java From gdx-facebook with Apache License 2.0 | votes |
ArrayMap<String, String> getHeaders();
Example #21
Source File: Request.java From gdx-facebook with Apache License 2.0 | votes |
AbstractRequest putFields(ArrayMap<String, String> fields);