コード例 #1
0
ファイル: missionArea.cpp プロジェクト: 03050903/Torque3D
U32 MissionArea::packUpdate(NetConnection *, U32 mask, BitStream * stream)
{
   if(stream->writeFlag(mask & UpdateMask))
   {
      mathWrite(*stream, mArea);
      stream->write(mFlightCeiling);
      stream->write(mFlightCeilingRange);
   }
   return(0);
}
コード例 #2
0
U32 HexagonVolumeCollisionShape::packUpdate(NetConnection *connection, U32 mask, BitStream *bstream)
{
   U32 retMask = Parent::packUpdate(connection,mask,bstream);
   if (bstream->writeFlag(mask & PositionMask | ExtendedInfoMask))
   {

      // Write the transform (do _not_ use writeAffineTransform.  Since this is a static
      //  object, the transform must be RIGHT THE *&)*$&^ ON or it will goof up the
      //  synchronization between the client and the server.
      mathWrite(*bstream,mObjToWorld);
      mathWrite(*bstream, mObjScale);
   }

   if (mLightPlugin) 
   {
      retMask |= mLightPlugin->packUpdate(this, ExtendedInfoMask, connection, mask, bstream);
   }

   return retMask;
}
コード例 #3
0
U32 MissionMarker::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
{
   U32 retMask = Parent::packUpdate(con, mask, stream);
   if(stream->writeFlag(mask & PositionMask))
   {
      stream->writeAffineTransform(mObjToWorld);
      mathWrite(*stream, mObjScale);
   }

   return(retMask);
}
コード例 #4
0
ファイル: basicClouds.cpp プロジェクト: 1414648814/Torque3D
U32 BasicClouds::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( conn, mask, stream );

   for ( U32 i = 0; i < TEX_COUNT; i++ )
   {
      stream->writeFlag( mLayerEnabled[i] );

      stream->write( mTexName[i] );

      stream->write( mTexScale[i] );
      mathWrite( *stream, mTexDirection[i] );
      stream->write( mTexSpeed[i] );   
      mathWrite( *stream, mTexOffset[i] );
      
      stream->write( mHeight[i] );
   }
   
   return retMask;
}
コード例 #5
0
ファイル: splash.cpp プロジェクト: fr1tz/terminal-overload
//--------------------------------------------------------------------------
// packUpdate
//--------------------------------------------------------------------------
U32 Splash::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
{
   U32 retMask = Parent::packUpdate(con, mask, stream);

   if( stream->writeFlag(mask & GameBase::InitialUpdateMask) )
   {
      mathWrite(*stream, mInitialPosition);
   }

   return retMask;
}
コード例 #6
0
ファイル: trigger.cpp プロジェクト: souxiaosou/OmniEngine.Net
U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
{
   U32 i;
   U32 retMask = Parent::packUpdate(con, mask, stream);

   if( stream->writeFlag( mask & TransformMask ) )
   {
      stream->writeAffineTransform(mObjToWorld);
   }

   // Write the polyhedron
   if( stream->writeFlag( mask & PolyMask ) )
   {
      stream->write(mTriggerPolyhedron.pointList.size());
      for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++)
         mathWrite(*stream, mTriggerPolyhedron.pointList[i]);

      stream->write(mTriggerPolyhedron.planeList.size());
      for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++)
         mathWrite(*stream, mTriggerPolyhedron.planeList[i]);

      stream->write(mTriggerPolyhedron.edgeList.size());
      for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) {
         const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i];

         stream->write(rEdge.face[0]);
         stream->write(rEdge.face[1]);
         stream->write(rEdge.vertex[0]);
         stream->write(rEdge.vertex[1]);
      }
   }

   if( stream->writeFlag( mask & EnterCmdMask ) )
      stream->writeLongString(CMD_SIZE-1, mEnterCommand.c_str());
   if( stream->writeFlag( mask & LeaveCmdMask ) )
      stream->writeLongString(CMD_SIZE-1, mLeaveCommand.c_str());
   if( stream->writeFlag( mask & TickCmdMask ) )
      stream->writeLongString(CMD_SIZE-1, mTickCommand.c_str());

   return retMask;
}
コード例 #7
0
U32 ProximityMine::packUpdate( NetConnection* connection, U32 mask, BitStream* stream )
{
   // Handle rotation ourselves (so it is not locked to the Z axis like for Items)
   U32 retMask = Parent::packUpdate( connection, mask & (~Item::RotationMask), stream );

   if ( stream->writeFlag( mask & Item::RotationMask ) )
   {
      QuatF rot( mObjToWorld );
      mathWrite( *stream, rot );
   }

   if ( stream->writeFlag( !mStatic && ( mask & DeployedMask ) && ( mState > Thrown ) ) )
   {
      mathWrite( *stream, mStickyCollisionPos );
      mathWrite( *stream, mStickyCollisionNormal );
   }

   stream->writeFlag( ( mask & ExplosionMask ) && ( mState == Exploded ) );

   return retMask;
}
コード例 #8
0
ファイル: decalRoad.cpp プロジェクト: Adhdcrazzy/Torque3D
void DecalRoadNodeEvent::pack(NetConnection* conn, BitStream* stream)
{
   Parent::pack( conn, stream );

   stream->writeInt( mPositions.size(), 16 );

   for (U32 i=0; i<mPositions.size(); ++i)
   {
      mathWrite( *stream, mPositions[i] );
      stream->write( mWidths[i] );
   }
}
コード例 #9
0
ファイル: coverPoint.cpp プロジェクト: 03050903/Torque3D
U32 CoverPoint::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
{
   U32 retMask = Parent::packUpdate(conn, mask, stream);

   stream->writeInt(mSize, 4);

   stream->writeFlag(mOccupied);

   stream->writeFlag(peekLeft());
   stream->writeFlag(peekRight());
   stream->writeFlag(peekOver());

   // Write our transform information
   if(stream->writeFlag(mask & TransformMask))
   {
      mathWrite(*stream, getTransform());
      mathWrite(*stream, getScale());
   }

   return retMask;
}
コード例 #10
0
void PathManagerEvent::pack(NetConnection*, BitStream* stream)
{
   // Write out the modified path...
   stream->write(modifiedPath);
   stream->writeFlag(clearPaths);
   stream->write(path.totalTime);
   stream->write(path.positions.size());


   // This is here for safety. You can remove it if you want to try your luck at bigger sizes. -- BJG
   AssertWarn(path.positions.size() < 1500/40, "Warning! Path size is pretty big - may cause packet overrun!");

   // Each one of these is about 8 floats and 2 ints
   // so we'll say it's about 40 bytes in size, which is where the 40 in the above calc comes from.
   for (U32 j = 0; j < path.positions.size(); j++)
   {
      mathWrite(*stream, path.positions[j]);
      mathWrite(*stream, path.rotations[j]);
      stream->write(path.msToNext[j]);
      stream->write(path.smoothingType[j]);
   }
}
コード例 #11
0
ファイル: splash.cpp プロジェクト: fr1tz/terminal-overload
//--------------------------------------------------------------------------
// Pack data
//--------------------------------------------------------------------------
void SplashData::packData(BitStream* stream)
{
   Parent::packData(stream);

   mathWrite(*stream, scale);
   stream->write(delayMS);
   stream->write(delayVariance);
   stream->write(lifetimeMS);
   stream->write(lifetimeVariance);
   stream->write(width);
   stream->write(numSegments);
   stream->write(velocity);
   stream->write(height);
   stream->write(acceleration);
   stream->write(texWrap);
   stream->write(texFactor);
   stream->write(ejectionFreq);
   stream->write(ejectionAngle);
   stream->write(ringLifetime);
   stream->write(startRadius);

   if( stream->writeFlag( explosion ) )
   {
      stream->writeRangedU32(explosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
   }

   S32 i;
   for( i=0; i<NUM_EMITTERS; i++ )
   {
      if( stream->writeFlag( emitterList[i] != NULL ) )
      {
         stream->writeRangedU32( emitterList[i]->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
      }
   }

   for( i=0; i<NUM_TIME_KEYS; i++ )
   {
      stream->write( colors[i] );
   }

   for( i=0; i<NUM_TIME_KEYS; i++ )
   {
      stream->write( times[i] );
   }

   for( i=0; i<NUM_TEX; i++ )
   {
      stream->writeString(textureName[i]);
   }
}
コード例 #12
0
ファイル: item.cpp プロジェクト: Bloodknight/GMK
U32 Item::packUpdate(NetConnection *connection, U32 mask, BitStream *stream)
{
   U32 retMask = Parent::packUpdate(connection,mask,stream);

   if (stream->writeFlag(mask & InitialUpdateMask)) {
      stream->writeFlag(mRotate);
      stream->writeFlag(mStatic);
      if (stream->writeFlag(getScale() != Point3F(1, 1, 1)))
         mathWrite(*stream, getScale());
   }

   if (mask & ThrowSrcMask && mCollisionObject) {
      S32 gIndex = connection->getGhostIndex(mCollisionObject);
      if (stream->writeFlag(gIndex != -1))
         stream->writeInt(gIndex,NetConnection::GhostIdBitSize);
   }
   else
      stream->writeFlag(false);

   if (stream->writeFlag(mask & RotationMask && !mRotate)) {
      // Assumes rotation is about the Z axis
      AngAxisF aa(mObjToWorld);
      stream->writeFlag(aa.axis.z < 0);
      stream->write(aa.angle);
   }

   if (stream->writeFlag(mask & PositionMask)) {
      Point3F pos;
      mObjToWorld.getColumn(3,&pos);
      mathWrite(*stream, pos);
      if (!stream->writeFlag(mAtRest)) {
         mathWrite(*stream, mVelocity);
      }
      stream->writeFlag(!(mask & NoWarpMask));
   }
   return retMask;
}
コード例 #13
0
U32 PxCloth::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( conn, mask, stream );

   if ( stream->writeFlag( mask & TransformMask ) )
      mathWrite( *stream, getTransform() );

   // start jc
   if ( stream->writeFlag( mask & ScaleAttachmentPointsMask ) )
      mathWrite( *stream, mAttachmentPointScale);
   // end jc

   if ( stream->writeFlag( mask & MaterialMask ) )
      stream->write( mMaterialName );

   if ( stream->writeFlag( mask & ClothMask ) )
   {
      mathWrite( *stream, mPatchVerts );
      mathWrite( *stream, mPatchSize );

      stream->write( mAttachmentMask );

      stream->writeFlag( mBendingEnabled );
      stream->writeFlag( mDampingEnabled );
      stream->writeFlag( mTriangleCollisionEnabled );
      stream->writeFlag( mSelfCollisionEnabled );
      stream->write( mThickness );
      stream->write( mFriction );
      stream->write( mBendingStiffness );
      stream->write( mDampingCoefficient );

      stream->write( mDensity );
   }

   return retMask;
}
コード例 #14
0
ファイル: etherform.cpp プロジェクト: fr1tz/terminal-overload
void Etherform::writePacketData(GameConnection *connection, BitStream *bstream)
{
	Parent::writePacketData(connection, bstream);

	Point3F pos;
	mObjToWorld.getColumn(3,&pos);
	bstream->setCompressionPoint(pos);
	mathWrite(*bstream, pos);

	bstream->write(mRot.x);
	bstream->write(mRot.z);

	bstream->write(mVelocity.x);
	bstream->write(mVelocity.y);
	bstream->write(mVelocity.z);
}
コード例 #15
0
U32 GroundPlane::packUpdate( NetConnection* connection, U32 mask, BitStream* stream )
{
   U32 retMask = Parent::packUpdate( connection, mask, stream );

   stream->write( mSquareSize );
   stream->write( mScaleU );
   stream->write( mScaleV );
   stream->write( mMaterialName );

   if ( stream->writeFlag( mask & UpdateMask ) )
   {
      mathWrite( *stream, getTransform() );
   }

   return retMask;
}
コード例 #16
0
U32 SceneObject::packUpdate( NetConnection* conn, U32 mask, BitStream* stream )
{
   U32 retMask = Parent::packUpdate( conn, mask, stream );

   if ( stream->writeFlag( mask & RareUpdatesMask ) )
	{
      stream->write(mCollisionMask);
      stream->writeRangedU32( (U32)mObjectFlags, 0, getObjectFlagMax() );

      for(U32 i = 0; i < Palette::NumSlots; i++)
      {
         if(stream->writeFlag(mPalette.colors[i] != Palette::defaultColor))
            stream->write(mPalette.colors[i]);
      }
	}

   if ( stream->writeFlag( mask & FlickerTimeMask ) )
      stream->write(mFlickerTime);

   if ( mask & MountedMask ) 
   {                  
      if ( mMount.object ) 
      {
         S32 gIndex = conn->getGhostIndex( mMount.object );

         if ( stream->writeFlag( gIndex != -1 ) ) 
         {
            stream->writeFlag( true );
            stream->writeInt( gIndex, NetConnection::GhostIdBitSize );
            if ( stream->writeFlag( mMount.node != -1 ) )
               stream->writeInt( mMount.node, NumMountPointBits );
            mathWrite( *stream, mMount.xfm );
         }
         else
            // Will have to try again later
            retMask |= MountedMask;
      }
      else
         // Unmount if this isn't the initial packet
         if ( stream->writeFlag( !(mask & InitialUpdateMask) ) )
            stream->writeFlag( false );
   }
   else
      stream->writeFlag( false );
   
   return retMask;
}
コード例 #17
0
ファイル: hoverVehicle.cpp プロジェクト: caomw/Torque3D
//--------------------------------------------------------------------------
void HoverVehicleData::packData(BitStream* stream)
{
    Parent::packData(stream);

    stream->write(dragForce);
    stream->write(vertFactor);
    stream->write(floatingThrustFactor);
    stream->write(mainThrustForce);
    stream->write(reverseThrustForce);
    stream->write(strafeThrustForce);
    stream->write(turboFactor);
    stream->write(stabLenMin);
    stream->write(stabLenMax);
    stream->write(stabSpringConstant);
    stream->write(stabDampingConstant);
    stream->write(gyroDrag);
    stream->write(normalForce);
    stream->write(restorativeForce);
    stream->write(steeringForce);
    stream->write(rollForce);
    stream->write(pitchForce);
    mathWrite(*stream, dustTrailOffset);
    stream->write(triggerTrailHeight);
    stream->write(dustTrailFreqMod);

    for (S32 i = 0; i < MaxSounds; i++)
        if (stream->writeFlag(sound[i]))
            stream->writeRangedU32(packed? SimObjectId((uintptr_t)sound[i]):
                                   sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);

    for (S32 j = 0; j < MaxJetEmitters; j++)
    {
        if (stream->writeFlag(jetEmitter[j]))
        {
            SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
            stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast);
        }
    }

    if (stream->writeFlag( dustTrailEmitter ))
    {
        stream->writeRangedU32( dustTrailEmitter->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
    }
    stream->write(floatingGravMag);
    stream->write(brakingForce);
    stream->write(brakingActivationSpeed);
}
コード例 #18
0
ファイル: rigidBody.cpp プロジェクト: Duion/GuideBot
U32 RigidBody::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
{
	U32 retMask = Parent::packUpdate(con, mask, stream);
	bool hasServerPhysics = !Physics::getPhysics(false) && con->isLocalConnection();

	//set hasServerPhysic flag
	if ((mask&InitialUpdateMask))
	{
		if (!hasServerPhysics && mDataBlock->mOnlyOnClient)
		{
			setScopeAlways();
		}
	}
	//special cases:
	if (stream->writeFlag((mask&InitialUpdateMask) && (hasServerPhysics || mDataBlock->mOnlyOnClient)))
	{
		if (stream->writeFlag(hasServerPhysics))
		{
			PhysShape* shape = mPhysShape;
			stream->writeBits(8*sizeof(shape),&shape);
		}
		else
		{
			mathWrite(*stream,getTransform());
		}
		
	}

	if (stream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask)))
	{
		return retMask;
	}

	if (!hasServerPhysics && !mDataBlock->mOnlyOnClient && stream->writeFlag(mask & PositionMask))
	{
		/*
		VectorF linVel = mPhysShape->getLinVelocity();
		VectorF force = mPhysShape->getForce();
		Con::printf("Pack vel: %f %f %f momentum: %f %f %f ",linVel.x,linVel.y,linVel.z,
			force.x, force.y, force.z);*/

		mPhysShape->pack(stream);
	}

	return retMask;
}   
コード例 #19
0
U32 ForestWindEmitter::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
{
   U32 retMask = Parent::packUpdate( con, mask, stream );

   mathWrite( *stream, mObjToWorld );

   if ( stream->writeFlag( mask & EnabledMask ) )
      stream->writeFlag( mEnabled );

   if ( stream->writeFlag( mask & WindMask ) )
   {
      stream->write( mWindStrength );

      stream->write( mWindRadius );
      stream->writeFlag( mRadialEmitter );

      stream->write( mWindGustStrength );
      stream->write( mWindGustFrequency );

      stream->write( mWindGustYawAngle );
      stream->write( mWindGustYawFrequency );
      stream->write( mWindGustWobbleStrength );

      stream->write( mWindTurbulenceStrength );
      stream->write( mWindTurbulenceFrequency );

      // The wind direction should be normalized!
      if ( mWindDirection.isZero() )
      {
         VectorF forwardVec( 0, 0, 0 );
         mWorldToObj.getColumn( 1, &mWindDirection );
      }
      else
         mWindDirection.normalize();

      stream->writeNormalVector( mWindDirection, 8 );  

      stream->writeFlag( mHasMount );
   } 

   return retMask;
}
コード例 #20
0
void LightFlareData::packData( BitStream *stream )
{
   Parent::packData( stream );

   stream->writeFlag( mFlareEnabled );
   stream->write( mFlareTextureName );   
   stream->write( mScale );
   stream->write( mOcclusionRadius );

   stream->write( mElementCount );

   for ( U32 i = 0; i < mElementCount; i++ )
   {
      mathWrite( *stream, mElementRect[i] );
      stream->write( mElementDist[i] );
      stream->write( mElementScale[i] );
      stream->write( mElementTint[i] );
      stream->writeFlag( mElementRotate[i] );
      stream->writeFlag( mElementUseLightColor[i] );
   }
}
コード例 #21
0
ファイル: afxMooring.cpp プロジェクト: nev7n/Torque3D
U32 afxMooring::packUpdate(NetConnection* conn, U32 mask, BitStream* stream)
{
  U32 retMask = Parent::packUpdate(conn, mask, stream);
  
  // InitialUpdate
  if (stream->writeFlag(mask & InitialUpdateMask)) 
  {
    stream->write(chor_id);
    stream->writeString(ghost_cons_name);
  }
  
  if (stream->writeFlag(mask & PositionMask)) 
  {
    if (mDataBlock->track_pos_only)
      mathWrite(*stream, mObjToWorld.getPosition());
    else
      stream->writeAffineTransform(mObjToWorld);
  } 
  
  return retMask;
}
コード例 #22
0
ファイル: cloudLayer.cpp プロジェクト: practicing01/Torque3D
U32 CloudLayer::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( conn, mask, stream );

   stream->write( mTextureName );
   
   for ( U32 i = 0; i < TEX_COUNT; i++ )
   {
      stream->write( mTexScale[i] );      
      stream->write( mTexSpeed[i] );
      mathWrite( *stream, mTexDirection[i] );
   }

   stream->write( mBaseColor );
   stream->write( mCoverage );
   stream->write( mExposure );
   stream->write( mWindSpeed );
   stream->write( mHeight );

   return retMask;
}
コード例 #23
0
ファイル: decalRoad.cpp プロジェクト: adhistac/ee-client-2-0
U32 DecalRoad::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
{  
   // Pack Parent.
   U32 retMask = Parent::packUpdate(con, mask, stream);

   if ( stream->writeFlag( mask & NodeMask ) )
   {
      stream->writeInt( mNodes.size(), 16 );

      for ( U32 i = 0; i < mNodes.size(); i++ )
      {
         mathWrite( *stream, mNodes[i].point );
         stream->write( mNodes[i].width );
      }
   }

   if ( stream->writeFlag( mask & DecalRoadMask ) )
   {
      // Write Texture Name.
      stream->write( mMaterialName );

      stream->write( mBreakAngle );      

      stream->write( mSegmentsPerBatch );

      stream->write( mTextureLength );

      stream->write( mRenderPriority );
   }

   stream->writeFlag( mask & GenEdgesMask );

   stream->writeFlag( mask & ReClipMask );

   stream->writeFlag( mask & TerrainChangedMask );

   // Were done ...
   return retMask;
}
コード例 #24
0
ファイル: physShape.cpp プロジェクト: Bloodknight/GMK
void	PhysShape::pack(BitStream* stream)
{
    if (stream->writeFlag(isEnabled()))
    {
        bool active = stream->writeFlag(isActive());
        if (!active)
        {
            bool toInactive = active!=mPrevActive;
            mPrevActive = active;
            if (!stream->writeFlag(toInactive))
                return;
        }
        else
            mPrevActive = true;

        mathWrite(*stream, getPosition());
        mathWrite(*stream, getRotation());
        mathWrite(*stream, getForce());
        mathWrite(*stream, getTorque());
        mathWrite(*stream, getLinVelocity());
        mathWrite(*stream, getAngVelocity());
    }

}
コード例 #25
0
ファイル: decalRoad.cpp プロジェクト: Adhdcrazzy/Torque3D
U32 DecalRoad::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
{  
   // Pack Parent.
   U32 retMask = Parent::packUpdate(con, mask, stream);

   if ( stream->writeFlag( mask & DecalRoadMask ) )
   {
      // Write Texture Name.
      stream->write( mMaterialName );

      stream->write( mBreakAngle );      

      stream->write( mSegmentsPerBatch );

      stream->write( mTextureLength );

      stream->write( mRenderPriority );
   }

   if ( stream->writeFlag( mask & NodeMask ) )
   {
      //stream->writeInt( mNodes.size(), 16 );

      //for ( U32 i = 0; i < mNodes.size(); i++ )
      //{
      //   mathWrite( *stream, mNodes[i].point );
      //   stream->write( mNodes[i].width );
      //}

      const U32 nodeByteSize = 16; // Based on sending all of a node's parameters

      // Test if we can fit all of our nodes within the current stream.
      // We make sure we leave 100 bytes still free in the stream for whatever
      // may follow us.
      S32 allowedBytes = stream->getWriteByteSize() - 100;
      if ( stream->writeFlag( (nodeByteSize * mNodes.size()) < allowedBytes ) )
      {
         // All nodes should fit, so send them out now.
         stream->writeInt( mNodes.size(), 16 );

         for ( U32 i = 0; i < mNodes.size(); i++ )
         {
            mathWrite( *stream, mNodes[i].point );
            stream->write( mNodes[i].width );
         }
      }
      else
      {
         // There isn't enough space left in the stream for all of the
         // nodes.  Batch them up into NetEvents.
         U32 id = gServerNodeListManager->nextListId();
         U32 count = 0;
         U32 index = 0;
         while (count < mNodes.size())
         {
            count += NodeListManager::smMaximumNodesPerEvent;
            if (count > mNodes.size())
            {
               count = mNodes.size();
            }

            DecalRoadNodeEvent* event = new DecalRoadNodeEvent();
            event->mId = id;
            event->mTotalNodes = mNodes.size();
            event->mLocalListStart = index;

            for (; index<count; ++index)
            {
               event->mPositions.push_back( mNodes[index].point );
               event->mWidths.push_back( mNodes[index].width );
            }

            con->postNetEvent( event );
         }

         stream->write( id );
      }
   }

   stream->writeFlag( mask & GenEdgesMask );

   stream->writeFlag( mask & ReClipMask );

   stream->writeFlag( mask & TerrainChangedMask );

   // Were done ...
   return retMask;
}
コード例 #26
0
ファイル: waterObject.cpp プロジェクト: AlkexGas/Torque3D
U32 WaterObject::packUpdate( NetConnection * conn, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( conn, mask, stream );

   if ( stream->writeFlag( mask & UpdateMask ) )
   {
      stream->write( mDensity );
      stream->write( mViscosity );
      stream->write( mLiquidType );

      if ( stream->writeFlag( mFullReflect ) )
      {
         stream->write( mReflectorDesc.priority );
         stream->writeInt( mReflectorDesc.maxRateMs, 32 );
         //stream->write( mReflectMaxDist );
         //stream->write( mReflectMinDist );
         stream->write( mReflectorDesc.detailAdjust );         
         stream->writeFlag( mReflectNormalUp );
         stream->writeFlag( mReflectorDesc.useOcclusionQuery );
         stream->writeInt( mReflectorDesc.texSize, 32 );
      }

      stream->write( mReflectivity );

      stream->write( mWaterFogData.density );
      stream->write( mWaterFogData.densityOffset );      
      stream->write( mWaterFogData.wetDepth );
      stream->write( mWaterFogData.wetDarkening );

      stream->write( mDistortStartDist );
      stream->write( mDistortEndDist );
      stream->write( mDistortFullDepth );

      stream->write( mDepthGradientMax );
      stream->writeFlag( mEmissive );
      
      stream->write( mFoamMaxDepth );
      stream->write( mFoamAmbientLerp );     
      stream->write( mFoamRippleInfluence );

      stream->write( mWaterFogData.color );

      stream->write( mFresnelBias );
      stream->write( mFresnelPower );
      
      Point4F specularData( mSpecularColor.red, mSpecularColor.green, mSpecularColor.blue, mSpecularPower );      
      mathWrite( *stream, specularData );

      stream->write( mClarity );
      stream->write( mUnderwaterColor );

      stream->write( mOverallRippleMagnitude );
      stream->write( mOverallWaveMagnitude );
      stream->write( mOverallFoamOpacity );
   }

   if ( stream->writeFlag( mask & WaveMask ) )
   {
      for( U32 i=0; i<MAX_WAVES; i++ )
      {
         stream->write( mRippleSpeed[i] );
         mathWrite( *stream, mRippleDir[i] );
         mathWrite( *stream, mRippleTexScale[i] );
         stream->write( mRippleMagnitude[i] );

         stream->write( mWaveSpeed[i] );
         mathWrite( *stream, mWaveDir[i] );
         stream->write( mWaveMagnitude[i] );  
      }

      for ( U32 i = 0; i < MAX_FOAM; i++ )
      {
         stream->write( mFoamSpeed[i] );
         mathWrite( *stream, mFoamDir[i] );
         mathWrite( *stream, mFoamTexScale[i] );
         stream->write( mFoamOpacity[i] );
      }
   }

   if ( stream->writeFlag( mask & MaterialMask ) )
   {
      for ( U32 i = 0; i < NumMatTypes; i++ )      
         stream->write( mSurfMatName[i] );
   }

   if ( stream->writeFlag( mask & TextureMask ) )
   {
      stream->write( mRippleTexName );
      stream->write( mDepthGradientTexName );
      stream->write( mFoamTexName );
      stream->write( mCubemapName );      
   }

   if( stream->writeFlag( mask & SoundMask ) )
      sfxWrite( stream, mSoundAmbience );

   return retMask;
}
コード例 #27
0
ファイル: sfxEmitter.cpp プロジェクト: Azaezel/Torque3D
U32 SFXEmitter::packUpdate( NetConnection *con, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( con, mask, stream );

   if( stream->writeFlag( mask & InitialUpdateMask ) )
   {
      // If this is the initial update then all the source
      // values are dirty and must be transmitted.
      mask |= TransformUpdateMask;
      mDirty = AllDirtyMask;

      // Clear the source masks... they are not
      // used during an initial update!
      mask &= ~AllSourceMasks;
   }

   stream->writeFlag( mPlayOnAdd );

   // transform
   if( stream->writeFlag( mask & TransformUpdateMask ) )
      stream->writeAffineTransform( mObjToWorld );

   // track
   if( stream->writeFlag( mDirty.test( Track ) ) )
      sfxWrite( stream, mTrack );

   // filename
   if( stream->writeFlag( mDirty.test( Filename ) ) )
      stream->writeString( mLocalProfile.mFilename );

   // volume
   if( stream->writeFlag( mDirty.test( Volume ) ) )
      stream->write( mDescription.mVolume );
      
   // pitch
   if( stream->writeFlag( mDirty.test( Pitch ) ) )
      stream->write( mDescription.mPitch );

   // islooping
   if( stream->writeFlag( mDirty.test( IsLooping ) ) )
      stream->writeFlag( mDescription.mIsLooping );
      
   // isStreaming
   if( stream->writeFlag( mDirty.test( IsStreaming ) ) )
      stream->writeFlag( mDescription.mIsStreaming );

   // is3d
   if( stream->writeFlag( mDirty.test( Is3D ) ) )
      stream->writeFlag( mDescription.mIs3D );

   // minDistance
   if( stream->writeFlag( mDirty.test( MinDistance ) ) )
      stream->write( mDescription.mMinDistance );

   // maxdistance
   if( stream->writeFlag( mDirty.test( MaxDistance) ) )
      stream->write( mDescription.mMaxDistance );

   // coneinsideangle
   if( stream->writeFlag( mDirty.test( ConeInsideAngle ) ) )
      stream->write( mDescription.mConeInsideAngle );

   // coneoutsideangle
   if( stream->writeFlag( mDirty.test( ConeOutsideAngle ) ) )
      stream->write( mDescription.mConeOutsideAngle );

   // coneoutsidevolume
   if( stream->writeFlag( mDirty.test( ConeOutsideVolume ) ) )
      stream->write( mDescription.mConeOutsideVolume );

   // sourcegroup
   if( stream->writeFlag( mDirty.test( SourceGroup ) ) )
      sfxWrite( stream, mDescription.mSourceGroup );
      
   // fadein
   if( stream->writeFlag( mDirty.test( FadeInTime ) ) )
      stream->write( mDescription.mFadeInTime );
      
   // fadeout
   if( stream->writeFlag( mDirty.test( FadeOutTime ) ) )
      stream->write( mDescription.mFadeOutTime );
      
   // scatterdistance
   if( stream->writeFlag( mDirty.test( ScatterDistance ) ) )
      mathWrite( *stream, mDescription.mScatterDistance );

   mDirty.clear();
   
   stream->writeFlag( mUseTrackDescriptionOnly );

   // We should never have both source masks 
   // enabled at the same time!
   AssertFatal( ( mask & AllSourceMasks ) != AllSourceMasks, 
      "SFXEmitter::packUpdate() - Bad source mask!" );

   // Write the source playback state.
   stream->writeFlag( mask & SourcePlayMask );
   stream->writeFlag( mask & SourceStopMask );

   return retMask;
}