当前位置: 首页>>代码示例>>Java>>正文


Java IntArray.set方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.IntArray.set方法的典型用法代码示例。如果您正苦于以下问题:Java IntArray.set方法的具体用法?Java IntArray.set怎么用?Java IntArray.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.IntArray的用法示例。


在下文中一共展示了IntArray.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calchull

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private int calchull (ObjectArrayList<Vector3> verts, int verts_count, IntArray tris_out, int[] tris_count, int vlimit) {
	int rc = calchullgen(verts, verts_count, vlimit);
	if (rc == 0) return 0;

	IntArray ts = new IntArray();

	for (int i = 0; i < tris.size(); i++) {
		if (tris.getQuick(i) != null) {
			for (int j = 0; j < 3; j++) {
				ts.add((tris.getQuick(i)).getCoord(j));
			}
			deAllocateTriangle(tris.getQuick(i));
		}
	}
	tris_count[0] = ts.size / 3;
	MiscUtil.resize(tris_out, ts.size, 0);

	for (int i = 0; i < ts.size; i++) {
		tris_out.set(i, ts.get(i));
	}
	MiscUtil.resize(tris, 0, NEW_TRI_SUPPLIER);

	return 1;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:25,代码来源:HullLibrary.java

示例2: bringOutYourDead

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private void bringOutYourDead (ObjectArrayList<Vector3> verts, int vcount, ObjectArrayList<Vector3> overts, int[] ocount,
	IntArray indices, int indexcount) {
	IntArray tmpIndices = new IntArray();
	for (int i = 0; i < vertexIndexMapping.size; i++) {
		tmpIndices.add(vertexIndexMapping.size);
	}

	IntArray usedIndices = new IntArray();
	MiscUtil.resize(usedIndices, vcount, 0);
	/*
	 * JAVA NOTE: redudant for (int i=0; i<vcount; i++) { usedIndices.set(i, 0); }
	 */

	ocount[0] = 0;

	for (int i = 0; i < indexcount; i++) {
		int v = indices.get(i); // original array index

		assert (v >= 0 && v < vcount);

		if (usedIndices.get(v) != 0) { // if already remapped
			indices.set(i, usedIndices.get(v) - 1); // index to new array
		} else {
			indices.set(i, ocount[0]); // new index mapping

			overts.getQuick(ocount[0]).set(verts.getQuick(v)); // copy old vert to new vert array

			for (int k = 0; k < vertexIndexMapping.size; k++) {
				if (tmpIndices.get(k) == v) {
					vertexIndexMapping.set(k, ocount[0]);
				}
			}

			ocount[0]++; // increment output vert count

			assert (ocount[0] >= 0 && ocount[0] <= vcount);

			usedIndices.set(v, ocount[0]); // assign new index remapping
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:42,代码来源:HullLibrary.java

示例3: maxdirsterid

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private static int maxdirsterid (ObjectArrayList<Vector3> p, int count, Vector3 dir, IntArray allow) {
	Stack stack = Stack.enter();
	Vector3 tmp = stack.allocVector3();
	Vector3 tmp1 = stack.allocVector3();
	Vector3 tmp2 = stack.allocVector3();
	Vector3 u = stack.allocVector3();
	Vector3 v = stack.allocVector3();

	int m = -1;
	while (m == -1) {
		m = maxdirfiltered(p, count, dir, allow);
		if (allow.get(m) == 3) {
			return m;
		}
		orth(dir, u);
		v.set(u).crs(dir);
		int ma = -1;
		for (float x = 0f; x <= 360f; x += 45f) {
			float s = (float)Math.sin(BulletGlobals.SIMD_RADS_PER_DEG * (x));
			float c = (float)Math.cos(BulletGlobals.SIMD_RADS_PER_DEG * (x));

			tmp1.set(u).scl(s);
			tmp2.set(v).scl(c);
			tmp.set(tmp1).add(tmp2);
			tmp.scl(0.025f);
			tmp.add(dir);
			int mb = maxdirfiltered(p, count, tmp, allow);
			if (ma == m && mb == m) {
				allow.set(m, 3);
				stack.leave();
				return m;
			}
			if (ma != -1 && ma != mb) { // Yuck - this is really ugly
				int mc = ma;
				for (float xx = x - 40f; xx <= x; xx += 5f) {
					s = (float)Math.sin(BulletGlobals.SIMD_RADS_PER_DEG * (xx));
					c = (float)Math.cos(BulletGlobals.SIMD_RADS_PER_DEG * (xx));

					tmp1.set(u).scl(s);
					tmp2.set(v).scl(c);
					tmp.set(tmp1).add(tmp2);
					tmp.scl(0.025f);
					tmp.add(dir);

					int md = maxdirfiltered(p, count, tmp, allow);
					if (mc == m && md == m) {
						allow.set(m, 3);
						stack.leave();
						return m;
					}
					mc = md;
				}
			}
			ma = mb;
		}
		allow.set(m, 0);
		m = -1;
	}
	assert (false);
	stack.leave();
	return m;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:63,代码来源:HullLibrary.java


注:本文中的com.badlogic.gdx.utils.IntArray.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。