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


C++ U32函数代码示例

本文整理汇总了C++中U32函数的典型用法代码示例。如果您正苦于以下问题:C++ U32函数的具体用法?C++ U32怎么用?C++ U32使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: LOG_AI

  //
  // Remove the token from the system
  //
  void Placement::RemoveToken(Base::Token &token)
  {
    Locator *locator = locatorsIdle.Find(U32(&token));

    if (locator)
    {
      locatorsIdle.Dispose(locator);
    }
    else
    {
      locator = locatorsActive.Find(U32(&token));

      if (locator)
      {
        // If the iterator is pointing at this locator, advance the iterator
        if (locator == *locatorsActiveIterator)
        {
          ++locatorsActiveIterator;
        }

        locatorsActiveList.Unlink(locator);
        locatorsActive.Dispose(locator);
      }
      else
      {
        LOG_AI(("No Idle or Active locator for token [%08X]", U32(&token)))
      }
    }
  }
开发者ID:ZhouWeikuan,项目名称:darkreign2,代码行数:32,代码来源:strategic_placement.cpp

示例2: U32

dpx::U32 dpx::IndustryHeader::TCFromString(const char* str) const
{
    // make sure the string is the correct length
    if(::strlen(str) != 11)
        return U32(~0);

    U32 tc = 0;
    int i, idx;
    U8 ch;
    U32 value, mask;

    for(i = 0; i < 8; i++)
    {
        // determine string index skipping :
        idx = i + ((i + 1) / 3);
        ch = str[idx];

        // error check
        if(ch < '0' || ch > '9')
            return 0xffffffff;

        value = U32(ch - '0') << (28 - (i * 4));
        mask = 0xf << (28 - (i * 4));

        // mask in new value
        tc = (tc & ~mask) | (value & mask);
    }

    return tc;
}
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:30,代码来源:DPXHeader.cpp

示例3: removeFromTable

void TCPObject::addToTable(NetSocket newTag)
{
   removeFromTable();
   mTag = newTag;
   mNext = table[U32(mTag) & TableMask];
   table[U32(mTag) & TableMask] = this;
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:7,代码来源:tcpObject.cpp

示例4: U32

void GuiGradientCtrl::removeColorRange( GuiGradientSwatchCtrl* swatch )
{
	if( mDisplayMode == pHorizColorRange )
	{
		if( mColorRange.size() <= 1 )
			return;

		for( S32 i = 0;i < mColorRange.size(); i++ ) 
		{
			if( mColorRange[i].swatch == swatch )
			{
				mColorRange.erase( U32(i) );
				swatch->safeDeleteObject();
				break;
			}
		}
	}
   else if( mDisplayMode == pHorizAlphaRange )
	{
		if( mAlphaRange.size() <= 1 )
			return;

		for( S32 i = 0;i < mAlphaRange.size(); i++ ) 
		{
			if( mAlphaRange[i].swatch == swatch )
			{
				mAlphaRange.erase( U32(i) );
				swatch->safeDeleteObject();
				break;	
			}
		}
	}
}
开发者ID:03050903,项目名称:Torque3D,代码行数:33,代码来源:guiGradientCtrl.cpp

示例5: getTransform

//--------------------------------------------------------------------------
U32 Projectile::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
{
   U32 retMask = Parent::packUpdate(con, mask, stream);

   // Initial update
   if (stream->writeFlag(mask & GameBase::InitialUpdateMask))
   {
      Point3F pos;
      getTransform().getColumn(3, &pos);
      stream->writeCompressedPoint(pos);
      F32 len = mCurrVelocity.len();
      if(stream->writeFlag(len > 0.02))
      {
         Point3F outVel = mCurrVelocity;
         outVel *= 1 / len;
         stream->writeNormalVector(outVel, 10);
         len *= 32.0; // 5 bits for fraction
         if(len > 8191)
            len = 8191;
         stream->writeInt((S32)len, 13);
      }

      stream->writeRangedU32(mCurrTick, 0, MaxLivingTicks);
      if (mSourceObject.isValid())
      {
         // Potentially have to write this to the client, let's make sure it has a
         //  ghost on the other side...
         S32 ghostIndex = con->getGhostIndex(mSourceObject);
         if (stream->writeFlag(ghostIndex != -1))
         {
            stream->writeRangedU32(U32(ghostIndex), 0, NetConnection::MaxGhostCount);
            stream->writeRangedU32(U32(mSourceObjectSlot),
                                   0, ShapeBase::MaxMountedImages - 1);
         }
         else // havn't recieved the ghost for the source object yet, try again later
            retMask |= GameBase::InitialUpdateMask;
      }
      else
         stream->writeFlag(false);
   }

   // explosion update
   if (stream->writeFlag((mask & ExplosionMask) && mHidden))
   {
      mathWrite(*stream, mExplosionPosition);
      mathWrite(*stream, mExplosionNormal);
      stream->write(mCollideHitType);
   }

   // bounce update
   if (stream->writeFlag(mask & BounceMask))
   {
      // Bounce against dynamic object
      mathWrite(*stream, mCurrPosition);
      mathWrite(*stream, mCurrVelocity);
   }

   return retMask;
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:60,代码来源:projectile.cpp

示例6: U32

template <typename T> U32 TVector4<T>::GetBGRAU32( void ) const
{	U32 r = U32(GetX()*T(255.0f));
	U32 g = U32(GetY()*T(255.0f));
	U32 b = U32(GetZ()*T(255.0f));
	U32 a = U32(GetW()*T(255.0f));
	
	return U32( (b<<24)|(g<<16)|(r<<8)|a );
}
开发者ID:andemi02,项目名称:orkid,代码行数:8,代码来源:cvector4.hpp

示例7: AssertFatal

void GFXGLCubemap::fillCubeTextures(GFXTexHandle* faces)
{
   AssertFatal( faces, "");
   AssertFatal( faces[0]->mMipLevels > 0, "");

   PRESERVE_CUBEMAP_TEXTURE();
   glBindTexture(GL_TEXTURE_CUBE_MAP, mCubemap);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, faces[0]->mMipLevels - 1 );
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
   
   U32 reqWidth = faces[0]->getWidth();
   U32 reqHeight = faces[0]->getHeight();
   GFXFormat regFaceFormat = faces[0]->getFormat();
   const bool isCompressed = isCompressedFormat(regFaceFormat);
   mWidth = reqWidth;
   mHeight = reqHeight;
   mFaceFormat = regFaceFormat;
   mMipLevels = getMax( (U32)1, faces[0]->mMipLevels);
   AssertFatal(reqWidth == reqHeight, "GFXGLCubemap::fillCubeTextures - Width and height must be equal!");
   
   for(U32 i = 0; i < 6; i++)
   {
      AssertFatal(faces[i], avar("GFXGLCubemap::fillCubeFaces - texture %i is NULL!", i));
      AssertFatal((faces[i]->getWidth() == reqWidth) && (faces[i]->getHeight() == reqHeight), "GFXGLCubemap::fillCubeFaces - All textures must have identical dimensions!");
      AssertFatal(faces[i]->getFormat() == regFaceFormat, "GFXGLCubemap::fillCubeFaces - All textures must have identical formats!");
      
      mTextures[i] = faces[i];
      GFXFormat faceFormat = faces[i]->getFormat();

        GFXGLTextureObject* glTex = static_cast<GFXGLTextureObject*>(faces[i].getPointer());
        if( isCompressed )
        {
            for( U32 mip = 0; mip < mMipLevels; ++mip )
            {
                const U32 mipWidth  = getMax( U32(1), faces[i]->getWidth() >> mip );
                const U32 mipHeight = getMax( U32(1), faces[i]->getHeight() >> mip );
                const U32 mipDataSize = getCompressedSurfaceSize( mFaceFormat, mWidth, mHeight, mip );

                U8* buf = glTex->getTextureData( mip );
                glCompressedTexImage2D(faceList[i], mip, GFXGLTextureInternalFormat[mFaceFormat], mipWidth, mipHeight, 0, mipDataSize, buf);
                delete[] buf;
            }
        }
        else
        {
            U8* buf = glTex->getTextureData();
            glTexImage2D(faceList[i], 0, GFXGLTextureInternalFormat[faceFormat], mWidth, mHeight, 
                0, GFXGLTextureFormat[faceFormat], GFXGLTextureType[faceFormat], buf);
            delete[] buf;
        }
   }
开发者ID:03050903,项目名称:Torque3D,代码行数:55,代码来源:gfxGLCubemap.cpp

示例8: U32

//--------------------------------------------------------------------------
U32 Projectile::packUpdate( NetConnection *con, U32 mask, BitStream *stream )
{
   U32 retMask = Parent::packUpdate( con, mask, stream );

   const bool isInitalUpdate = mask & GameBase::InitialUpdateMask;

   // InitialUpdateMask
   if ( stream->writeFlag( isInitalUpdate ) )
   {
      stream->writeRangedU32( mCurrTick, 0, MaxLivingTicks );

      if ( mSourceObject.isValid() )
      {
         // Potentially have to write this to the client, let's make sure it has a
         //  ghost on the other side...
         S32 ghostIndex = con->getGhostIndex( mSourceObject );
         if ( stream->writeFlag( ghostIndex != -1 ) )
         {
            stream->writeRangedU32( U32(ghostIndex), 
                                    0, 
                                    NetConnection::MaxGhostCount );

            stream->writeRangedU32( U32(mSourceObjectSlot),
                                    0, 
                                    ShapeBase::MaxMountedImages - 1 );
         }
         else 
            // have not recieved the ghost for the source object yet, try again later
            retMask |= GameBase::InitialUpdateMask;
      }
      else
         stream->writeFlag( false );
   }

   // ExplosionMask
   //
   // ExplosionMask will be set during the initial update but hidden is
   // only true if we have really exploded.
   if ( stream->writeFlag( ( mask & ExplosionMask ) && mHasExploded ) )
   {
      mathWrite(*stream, mExplosionPosition);
      mathWrite(*stream, mExplosionNormal);
      stream->write(mCollideHitType);
   }

   // BounceMask
   if ( stream->writeFlag( mask & BounceMask ) )
   {
      // Bounce against dynamic object
      mathWrite(*stream, mCurrPosition);
      mathWrite(*stream, mCurrVelocity);
   }

   return retMask;
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:56,代码来源:projectile.cpp

示例9: F32

// public static
void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**)
{
	llinfos << "LLWorldMap::processMapLayerReply from message system" << llendl;

	U32 agent_flags;
	msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags);

	if (agent_flags != (U32)LLWorldMap::getInstance()->mCurrentMap)
	{
		llwarns << "Invalid or out of date map image type returned!" << llendl;
		return;
	}

	LLUUID image_id;
	//U32 left, right, top, bottom;

	S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_LayerData);

	LLWorldMap::getInstance()->mMapLayers[agent_flags].clear();

	BOOL adjust = FALSE;
	for (S32 block=0; block<num_blocks; ++block)
	{
		LLWorldMapLayer new_layer;
		new_layer.LayerDefined = TRUE;
		msg->getUUIDFast(_PREHASH_LayerData, _PREHASH_ImageID, new_layer.LayerImageID, block);
		new_layer.LayerImage = gImageList.getImage(new_layer.LayerImageID, MIPMAP_TRUE, FALSE);

		gGL.getTexUnit(0)->bind(new_layer.LayerImage.get());
		new_layer.LayerImage->setAddressMode(LLTexUnit::TAM_CLAMP);
		
		U32 left, right, top, bottom;
		msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Left, left, block);
		msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Right, right, block);
		msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Top, top, block);
		msg->getU32Fast(_PREHASH_LayerData, _PREHASH_Bottom, bottom, block);

		new_layer.LayerExtents.mLeft = left;
		new_layer.LayerExtents.mRight = right;
		new_layer.LayerExtents.mBottom = bottom;
		new_layer.LayerExtents.mTop = top;

		F32 x_meters = F32(left*REGION_WIDTH_UNITS);
		F32 y_meters = F32(bottom*REGION_WIDTH_UNITS);
		adjust = LLWorldMap::getInstance()->extendAABB(U32(x_meters), U32(y_meters), 
							   U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()),
							   U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust;

		LLWorldMap::getInstance()->mMapLayers[agent_flags].push_back(new_layer);
	}

	LLWorldMap::getInstance()->mMapLoaded[agent_flags] = TRUE;
	if(adjust) gFloaterWorldMap->adjustZoomSliderBounds();
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:55,代码来源:llworldmap.cpp

示例10: U32

inline void LLImageTGA::decodeTruecolorPixel15( U8* dst, const U8* src )
{
    // We expand 5 bit data to 8 bit sample width.
    // The format of the 16-bit (LSB first) input word is
    // xRRRRRGGGGGBBBBB
	U32 t = U32(src[0]) + (U32(src[1]) << 8);
    dst[2] = s5to8bits[t & 0x1F];  // blue
    t >>= 5;
    dst[1] = s5to8bits[t & 0x1F];  // green
    t >>= 5;
    dst[0] = s5to8bits[t & 0x1F];  // red
}
开发者ID:AdeonWriter,项目名称:SingularityViewer,代码行数:12,代码来源:llimagetga.cpp

示例11: updateProgress

/// Convert all Collada materials into a single TSMaterialList
void TSShapeLoader::generateMaterialList()
{
   // Install the materials into the material list
   shape->materialList = new TSMaterialList;
   for (int iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++)
   {
      updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat);

      AppMaterial* appMat = AppMesh::appMaterials[iMat];
      shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance());
   }
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:13,代码来源:tsShapeLoader.cpp

示例12: checkArgList

/**
 * @luafunc Team LuaGameInfo::getTeam(int teamIndex)
 *
 * @brief Get a Team by index.
 *
 * @note Remember that Lua uses 1-based indices, so the index of the first team will be 1.
 *
 * @return The Team with the specified index.
 */
S32 LuaGameInfo::lua_getTeam(lua_State *L)
{
   checkArgList(L, functionArgs, "GameInfo", "getTeam");

   S32 index = getTeamIndex(L, 1);
   
   if(U32(index) >= U32(mServerGame->getTeamCount())) // Out of range index?
      return returnNil(L);

   TNLAssert(dynamic_cast<Team*>(mServerGame->getTeam(index)), "Bad team pointer or bad type");
   return returnTeam(L, static_cast<Team*>(mServerGame->getTeam(index)));
}
开发者ID:LibreGames,项目名称:bitfighter,代码行数:21,代码来源:luaGameInfo.cpp

示例13: U

//==============================================================================
Error TransientMemoryManager::init(const ConfigSet& cfg)
{
	Array<const char*, U(TransientBufferType::COUNT)> configVars = {
		{"gr.uniformPerFrameMemorySize",
			"gr.storagePerFrameMemorySize",
			"gr.vertexPerFrameMemorySize",
			"gr.transferPerFrameMemorySize"}};

	const VkPhysicalDeviceLimits& limits =
		m_manager->getImplementation().getPhysicalDeviceProperties().limits;
	Array<U32, U(TransientBufferType::COUNT)> alignments = {
		{U32(limits.minUniformBufferOffsetAlignment),
			U32(limits.minStorageBufferOffsetAlignment),
			sizeof(F32) * 4,
			sizeof(F32) * 4}};

	Array<BufferUsageBit, U(TransientBufferType::COUNT)> usages = {
		{BufferUsageBit::UNIFORM_ANY_SHADER,
			BufferUsageBit::STORAGE_ANY,
			BufferUsageBit::VERTEX,
			BufferUsageBit::TRANSFER_SOURCE}};

	auto alloc = m_manager->getAllocator();
	for(TransientBufferType i = TransientBufferType::UNIFORM;
		i < TransientBufferType::COUNT;
		++i)
	{
		PerFrameBuffer& frame = m_perFrameBuffers[i];
		frame.m_size = cfg.getNumber(configVars[i]);
		ANKI_ASSERT(frame.m_size);

		// Create buffer
		frame.m_buff = alloc.newInstance<BufferImpl>(m_manager);
		ANKI_CHECK(frame.m_buff->init(
			frame.m_size, usages[i], BufferMapAccessBit::WRITE));

		frame.m_bufferHandle = frame.m_buff->getHandle();

		// Map once
		frame.m_mappedMem = static_cast<U8*>(
			frame.m_buff->map(0, frame.m_size, BufferMapAccessBit::WRITE));
		ANKI_ASSERT(frame.m_mappedMem);

		// Init the allocator
		frame.m_alloc.init(frame.m_size, alignments[i]);
	}

	return ErrorCode::NONE;
}
开发者ID:Al1a123,项目名称:anki-3d-engine,代码行数:50,代码来源:TransientMemoryManager.cpp

示例14: ManchesterMode

bool ManchesterAnalyzerSettings::SetSettingsFromInterfaces()
{
	mInputChannel = mInputChannelInterface->GetChannel();
	mMode = ManchesterMode( U32( mModeInterface->GetNumber() ) );
	mBitRate = mBitRateInterface->GetInteger();
	mInverted = bool( U32( mInvertedInterface->GetNumber() ) );
	mBitsPerTransfer = U32( mBitsPerTransferInterface->GetNumber() );
	mShiftOrder =  AnalyzerEnums::ShiftOrder( U32( mShiftOrderInterface->GetNumber() ) );
	mBitsToIgnore = mNumBitsIgnoreInterface->GetInteger();
	mTolerance = ManchesterTolerance( U32( mToleranceInterface->GetNumber() ) );
	ClearChannels();
	AddChannel( mInputChannel, "Manchester", true );

	return true;
}
开发者ID:blargony,项目名称:RFFEAnalyzer,代码行数:15,代码来源:ManchesterAnalyzerSettings.cpp

示例15: AssertFatal

void SFXFMODEventSource::stop( F32 fadeOutTime )
{
   if( getStatus() == SFXStatusStopped )
      return;
      
   AssertFatal( mHandle, "SFXFMODEvent::stop() - event not acquired" );
   
   bool immediate = ( fadeOutTime == 0.f );
   
   FMOD_RESULT result = SFXFMODDevice::smFunc->FMOD_Event_Stop( mHandle, immediate );
   if( result != FMOD_OK )
      Con::errorf( "SFXFMODEventSource::stop() - failed to stop event: %s", FMODResultToString( result ).c_str() );

   mPlayTimer.stop();
   _setStatus( SFXStatusStopped );
   
   // Reset fade-in to default in case it got overwritten
   // in play().

   U32 fade = U32( mFadeInTime * 1000.f );
   SFXFMODDevice::smFunc->FMOD_Event_SetPropertyByIndex(
      mHandle, FMOD_EVENTPROPERTY_FADEIN,
      &fade, true
   );
   
   _stop();
}
开发者ID:03050903,项目名称:Torque3D,代码行数:27,代码来源:sfxFMODEventSource.cpp


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