本文整理汇总了C#中ObjectArray类的典型用法代码示例。如果您正苦于以下问题:C# ObjectArray类的具体用法?C# ObjectArray怎么用?C# ObjectArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectArray类属于命名空间,在下文中一共展示了ObjectArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiscreteDynamicsWorld
///this btDiscreteDynamicsWorld constructor gets created objects from the user, and will not delete those
public DiscreteDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
: base(dispatcher, pairCache, collisionConfiguration)
{
m_ownsIslandManager = true;
m_constraints = new ObjectArray<TypedConstraint>();
m_actions = new List<IActionInterface>();
m_nonStaticRigidBodies = new ObjectArray<RigidBody>();
m_islandManager = new SimulationIslandManager();
m_constraintSolver = constraintSolver;
Gravity = new Vector3(0, -10, 0);
m_localTime = 1f / 60f;
m_profileTimings = 0;
m_synchronizeAllMotionStates = false;
if (m_constraintSolver == null)
{
m_constraintSolver = new SequentialImpulseConstraintSolver();
m_ownsConstraintSolver = true;
}
else
{
m_ownsConstraintSolver = false;
}
}
示例2: LengthTest
public void LengthTest()
{
const int length = 3;
var stringArray = new ObjectArray<String>(length);
Assert.AreEqual(length, stringArray.Length);
}
示例3: MergePoints
//! classify points that are closer
public void MergePoints(ref Vector4 plane, float margin, ObjectArray<IndexedVector3> points, int point_count)
{
m_point_count = 0;
m_penetration_depth = -1000.0f;
int[] point_indices = new int[MAX_TRI_CLIPPING];
int _k;
for (_k = 0; _k < point_count; _k++)
{
float _dist = -ClipPolygon.DistancePointPlane(ref plane, ref points.GetRawArray()[_k]) + margin;
if (_dist >= 0.0f)
{
if (_dist > m_penetration_depth)
{
m_penetration_depth = _dist;
point_indices[0] = _k;
m_point_count = 1;
}
else if ((_dist + MathUtil.SIMD_EPSILON) >= m_penetration_depth)
{
point_indices[m_point_count] = _k;
m_point_count++;
}
}
}
for (_k = 0; _k < m_point_count; _k++)
{
m_points[_k] = points[point_indices[_k]];
}
}
示例4: InternalProcessTriangleIndex
public virtual void InternalProcessTriangleIndex(ObjectArray<Vector3> triangle, int partId, int triangleIndex)
{
Vector3 t1 = triangle[0];
Vector3 t2 = triangle[1];
Vector3 t3 = triangle[2];
OptimizedBvhNode node = new OptimizedBvhNode();
Vector3 aabbMin = MathUtil.MAX_VECTOR;
Vector3 aabbMax = MathUtil.MIN_VECTOR;
MathUtil.VectorMax(ref t1,ref aabbMax);
MathUtil.VectorMin(ref t1,ref aabbMin);
MathUtil.VectorMax(ref t2,ref aabbMax);
MathUtil.VectorMin(ref t2,ref aabbMin);
MathUtil.VectorMax(ref t3,ref aabbMax);
MathUtil.VectorMin(ref t3,ref aabbMin);
//with quantization?
node.m_aabbMinOrg = aabbMin;
node.m_aabbMaxOrg = aabbMax;
node.m_escapeIndex = -1;
//for child nodes
node.m_subPart = partId;
node.m_triangleIndex = triangleIndex;
m_triangleNodes.Add(node);
}
示例5: TriangleIndexVertexArray
//just to be backwards compatible
public TriangleIndexVertexArray(int numTriangles,ObjectArray<int> triangleIndexBase,int triangleIndexStride,int numVertices,Object vertexBase,int vertexStride)
{
// ignore the provided stride values as we infer them from the version of the ctor called...
IndexedMesh indexedMesh = new IndexedMesh();
indexedMesh.m_numTriangles = numTriangles;
indexedMesh.m_triangleIndexBase = triangleIndexBase;
indexedMesh.m_triangleIndexStride = 3;
indexedMesh.m_numVertices = numVertices;
indexedMesh.m_vertexBase = vertexBase;
if (vertexBase is ObjectArray<IndexedVector3>)
{
indexedMesh.m_vertexStride = 1;
}
#if XNA
else if (vertexBase is ObjectArray<Microsoft.Xna.Framework.Vector3>)
{
indexedMesh.m_vertexStride = 1;
}
#endif
else if (vertexBase is ObjectArray<float>)
{
indexedMesh.m_vertexStride = 3;
}
else
{
Debug.Assert(false,"Unsupported vertex object base.");
}
AddIndexedMesh(indexedMesh,PHY_ScalarType.PHY_INTEGER);
}
示例6: SimulationIslandManager
public SimulationIslandManager()
{
m_splitIslands = true;
m_unionFind = new UnionFind();
m_islandmanifold = new ObjectArray<PersistentManifold>();
m_islandBodies = new ObjectArray<CollisionObject>();
}
示例7: InternalProcessTriangleIndex
public virtual void InternalProcessTriangleIndex(ObjectArray<Vector3> triangle, int partId, int triangleIndex)
{
Matrix i = new Matrix();
Vector3 a = triangle[0] - m_center;
Vector3 b = triangle[1] - m_center;
Vector3 c = triangle[2] - m_center;
float volNeg = -System.Math.Abs(MathUtil.Vector3Triple(ref a,ref b,ref c) * (1f / 6f));
for (int j = 0; j < 3; j++)
{
for (int k = 0; k <= j; k++)
{
float aj = MathUtil.VectorComponent(ref a,j);
float ak = MathUtil.VectorComponent(ref a,k);
float bj = MathUtil.VectorComponent(ref b,j);
float bk = MathUtil.VectorComponent(ref b,k);
float cj = MathUtil.VectorComponent(ref c,j);
float ck = MathUtil.VectorComponent(ref c,k);
float temp = volNeg * (.1f * (aj * ak + bj * bk + cj * ck)
+ .05f * (aj * bk + ak * bj + aj * ck + ak * cj + bj * ck + bk * cj));
MathUtil.MatrixComponent(ref i,j,k,temp);
MathUtil.MatrixComponent(ref i,k,j,temp);
}
}
float i00 = -i.M11;
float i11 = -i.M22;
float i22 = -i.M33;
i.M11 = i11 + i22;
i.M22 = i22 + i00;
i.M33 = i00 + i11;
m_sum.Right += i.Right;
m_sum.Up += i.Up;
m_sum.Backward += i.Backward;
}
示例8: ProcessAllTriangles
public override void ProcessAllTriangles(ITriangleCallback callback, ref Vector3 aabbMin, ref Vector3 aabbMax)
{
Vector3 halfExtents = (aabbMax - aabbMin) * .5f;
float radius = halfExtents.Length();
Vector3 center = (aabbMax + aabbMin) * 0.5f;
//this is where the triangles are generated, given AABB and plane equation (normal/constant)
Vector3 tangentDir0 = Vector3.Zero;
Vector3 tangentDir1 = Vector3.Zero;
//tangentDir0/tangentDir1 can be precalculated
TransformUtil.PlaneSpace1(ref m_planeNormal,ref tangentDir0,ref tangentDir1);
Vector3 supVertex0 = Vector3.Zero;
Vector3 supVertex1 = Vector3.Zero;
Vector3 projectedCenter = center - (Vector3.Dot(m_planeNormal,center) - m_planeConstant)*m_planeNormal;
ObjectArray<Vector3> triangle = new ObjectArray<Vector3>(3);
triangle.Add(projectedCenter + tangentDir0*radius + tangentDir1*radius);
triangle.Add(projectedCenter + tangentDir0 * radius - tangentDir1 * radius);
triangle.Add(projectedCenter - tangentDir0 * radius - tangentDir1 * radius);
callback.ProcessTriangle(triangle,0,0);
triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
callback.ProcessTriangle(triangle,0,1);
}
示例9: CollisionWorld
//this constructor doesn't own the dispatcher and paircache/broadphase
public CollisionWorld(IDispatcher dispatcher, IBroadphaseInterface broadphasePairCache, ICollisionConfiguration collisionConfiguration)
{
m_dispatcher1 = dispatcher;
m_broadphasePairCache = broadphasePairCache;
m_collisionObjects = new ObjectArray<CollisionObject>();
m_dispatchInfo = new DispatcherInfo();
m_forceUpdateAllAabbs = true;
}
示例10: SortedOverlappingPairCache
public SortedOverlappingPairCache()
{
m_blockedForChanges = false;
m_hasDeferredRemoval = true;
m_overlapFilterCallback = null;
m_ghostPairCallback = null;
m_overlappingPairArray = new ObjectArray<BroadphasePair>(2);
}
示例11: InternalProcessTriangleIndex
public virtual void InternalProcessTriangleIndex(ObjectArray<Vector3> triangle,int partId,int triangleIndex)
{
if (AabbUtil2.TestTriangleAgainstAabb2(triangle,ref m_aabbMin,ref m_aabbMax))
{
//check aabb in triangle-space, before doing this
m_callback.ProcessTriangle(triangle,partId,triangleIndex);
}
}
示例12: HashedOverlappingPairCache
public HashedOverlappingPairCache()
{
m_overlapFilterCallback = null;
m_blockedForChanges = false;
m_ghostPairCallback = null;
int initialAllocatedSize = 2;
m_overlappingPairArray = new ObjectArray<BroadphasePair>(initialAllocatedSize);
GrowTables();
}
示例13: Method_asList
public void Method_asList()
{
var stringArray = new ObjectArray<String>(3);
stringArray[0] = "string 1";
stringArray[1] = "string 2";
stringArray[2] = "string 3";
List<String> list = jvm4csharp.java.util.Arrays.asList(stringArray);
AssertEx.IsValidJavaObject(list);
}
示例14: ProcessTriangle
public virtual void ProcessTriangle(ObjectArray<Vector3> triangle, int partId, int triangleIndex)
{
//aabb filter is already applied!
CollisionAlgorithmConstructionInfo ci = new CollisionAlgorithmConstructionInfo();
ci.SetDispatcher(m_dispatcher);
CollisionObject ob = (CollisionObject)m_triBody;
///debug drawing of the overlapping triangles
///
if (m_dispatchInfoPtr != null && m_dispatchInfoPtr.getDebugDraw() != null&& ((m_dispatchInfoPtr.getDebugDraw().GetDebugMode() & DebugDrawModes.DBG_DrawWireframe) > 0))
{
Vector3 color = new Vector3(1,1,0);
Matrix tr = ob.GetWorldTransform();
Vector3[] transformedTriangles = new Vector3[3];
for(int i=0;i<transformedTriangles.Length;++i)
{
transformedTriangles[i] = Vector3.Transform(triangle[i],tr);
}
m_dispatchInfoPtr.getDebugDraw().DrawLine(ref transformedTriangles[0], ref transformedTriangles[1], ref color);
m_dispatchInfoPtr.getDebugDraw().DrawLine(ref transformedTriangles[1], ref transformedTriangles[2], ref color);
m_dispatchInfoPtr.getDebugDraw().DrawLine(ref transformedTriangles[2], ref transformedTriangles[0], ref color);
}
if (m_convexBody.GetCollisionShape().IsConvex())
{
TriangleShape tm = new TriangleShape(triangle[0],triangle[1],triangle[2]);
tm.Margin = m_collisionMarginTriangle;
CollisionShape tmpShape = ob.GetCollisionShape();
ob.InternalSetTemporaryCollisionShape(tm);
CollisionAlgorithm colAlgo = ci.GetDispatcher().FindAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
///this should use the btDispatcher, so the actual registered algorithm is used
// btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);
if (m_resultOut.GetBody0Internal() == m_triBody)
{
m_resultOut.SetShapeIdentifiersA(partId, triangleIndex);
}
else
{
m_resultOut.SetShapeIdentifiersB(partId, triangleIndex);
}
colAlgo.ProcessCollision(m_convexBody,m_triBody,m_dispatchInfoPtr, m_resultOut);
colAlgo.Cleanup();
ci.GetDispatcher().FreeCollisionAlgorithm(colAlgo);
colAlgo = null;
ob.InternalSetTemporaryCollisionShape( tmpShape);
}
}
示例15: TriangleIndexVertexArray
//just to be backwards compatible
public TriangleIndexVertexArray(int numTriangles,ObjectArray<int> triangleIndexBase,int triangleIndexStride,int numVertices,ObjectArray<Vector3> vertexBase,int vertexStride)
{
IndexedMesh indexedMesh = new IndexedMesh();
indexedMesh.m_numTriangles = numTriangles;
indexedMesh.m_triangleIndexBase = triangleIndexBase;
indexedMesh.m_triangleIndexStride = triangleIndexStride;
indexedMesh.m_numVertices = numVertices;
indexedMesh.m_vertexBase = vertexBase;
indexedMesh.m_vertexStride = vertexStride;
AddIndexedMesh(indexedMesh,PHY_ScalarType.PHY_INTEGER);
}