本文整理汇总了C++中NxVec3::arrayMultiply方法的典型用法代码示例。如果您正苦于以下问题:C++ NxVec3::arrayMultiply方法的具体用法?C++ NxVec3::arrayMultiply怎么用?C++ NxVec3::arrayMultiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxVec3
的用法示例。
在下文中一共展示了NxVec3::arrayMultiply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unpackUpdate
void PxCloth::unpackUpdate( NetConnection *conn, BitStream *stream )
{
Parent::unpackUpdate( conn, stream );
// TransformMask
if ( stream->readFlag() )
{
MatrixF mat;
mathRead( *stream, &mat );
// start jc
if(mCloth)
{
NxVec3 delta(mat.getPosition() - getTransform().getPosition());
if(mCloth->isSleeping())
mCloth->wakeUp();
if ( mAttachmentMask & BIT( 0 ) )
mCloth->attachVertexToGlobalPosition( 0, mCloth->getPosition( 0 ) + delta );
if ( mAttachmentMask & BIT( 1 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x-1, mCloth->getPosition( mPatchVerts.x-1 ) + delta );
if ( mAttachmentMask & BIT( 2 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - mPatchVerts.x, mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - mPatchVerts.x ) + delta );
if ( mAttachmentMask & BIT( 3 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - 1, mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - 1 ) + delta );
if ( mAttachmentMask & BIT( 4 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - (mPatchVerts.x/2), mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - (mPatchVerts.x/2) ) + delta );
if ( mAttachmentMask & BIT( 5 ) )
mCloth->attachVertexToGlobalPosition( (mPatchVerts.x/2), mCloth->getPosition( (mPatchVerts.x/2) ) + delta );
if ( mAttachmentMask & BIT( 6 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x * (mPatchVerts.y/2), mCloth->getPosition( mPatchVerts.x * (mPatchVerts.y/2) ) + delta );
if ( mAttachmentMask & BIT( 7 ) )
mCloth->attachVertexToGlobalPosition( mPatchVerts.x * (mPatchVerts.y/2) + (mPatchVerts.x-1), mCloth->getPosition( mPatchVerts.x * (mPatchVerts.y/2) + (mPatchVerts.x-1) ) + delta );
if ( mAttachmentMask & BIT( 8 ) )
for ( U32 i = mPatchVerts.x * mPatchVerts.y - mPatchVerts.x; i < mPatchVerts.x * mPatchVerts.y; i++ )
mCloth->attachVertexToGlobalPosition( i, mCloth->getPosition( i ) + delta );
if ( mAttachmentMask & BIT( 9 ) )
for ( U32 i = 0; i < mPatchVerts.x; i++ )
mCloth->attachVertexToGlobalPosition( i, mCloth->getPosition( i ) + delta );
if ( mAttachmentMask & BIT( 10 ) )
for ( U32 i = 0; i < mPatchVerts.x * mPatchVerts.y; i+=mPatchVerts.x )
mCloth->attachVertexToGlobalPosition( i, mCloth->getPosition( i ) + delta );
if ( mAttachmentMask & BIT( 11 ) )
for ( U32 i = mPatchVerts.x-1; i < mPatchVerts.x * mPatchVerts.y; i+=mPatchVerts.x )
mCloth->attachVertexToGlobalPosition( i, mCloth->getPosition( i ) + delta );
}
// end jc
setTransform( mat );
}
// start jc
// ScaleAttachmentPointsMask
if ( stream->readFlag() )
{
Point3F attachmentPointScale;
mathRead( *stream, &attachmentPointScale );
if(mCloth)
{
Point3F scale(Point3F::One);
scale.convolveInverse(mAttachmentPointScale);
scale.convolve(attachmentPointScale);
NxVec3 delta(scale);
if(mCloth->isSleeping())
mCloth->wakeUp();
static NxVec3 delta2;
if ( mAttachmentMask & BIT( 0 ) )
{ delta2.arrayMultiply(mCloth->getPosition( 0 ),delta); mCloth->attachVertexToGlobalPosition( 0, delta2); }
if ( mAttachmentMask & BIT( 1 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x-1 ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x-1, delta2); }
if ( mAttachmentMask & BIT( 2 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - mPatchVerts.x ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - mPatchVerts.x, delta2); }
if ( mAttachmentMask & BIT( 3 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - 1 ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - 1, delta2); }
if ( mAttachmentMask & BIT( 4 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x * mPatchVerts.y - (mPatchVerts.x/2) ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x * mPatchVerts.y - (mPatchVerts.x/2), delta2); }
if ( mAttachmentMask & BIT( 5 ) )
{ delta2.arrayMultiply(mCloth->getPosition( (mPatchVerts.x/2) ), delta); mCloth->attachVertexToGlobalPosition( (mPatchVerts.x/2), delta2); }
if ( mAttachmentMask & BIT( 6 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x * (mPatchVerts.y/2) ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x * (mPatchVerts.y/2), delta2); }
if ( mAttachmentMask & BIT( 7 ) )
{ delta2.arrayMultiply(mCloth->getPosition( mPatchVerts.x * (mPatchVerts.y/2) + (mPatchVerts.x-1) ), delta); mCloth->attachVertexToGlobalPosition( mPatchVerts.x * (mPatchVerts.y/2) + (mPatchVerts.x-1), delta2); }
if ( mAttachmentMask & BIT( 8 ) )
for ( U32 i = mPatchVerts.x * mPatchVerts.y - mPatchVerts.x; i < mPatchVerts.x * mPatchVerts.y; i++ )
{ delta2.arrayMultiply(mCloth->getPosition( i ), delta); mCloth->attachVertexToGlobalPosition( i, delta2); }
if ( mAttachmentMask & BIT( 9 ) )
for ( U32 i = 0; i < mPatchVerts.x; i++ )
{ delta2.arrayMultiply(mCloth->getPosition( i ), delta); mCloth->attachVertexToGlobalPosition( i, delta2); }
if ( mAttachmentMask & BIT( 10 ) )
//.........这里部分代码省略.........