• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ F32函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: F32

QuatF & Quat16::getQuatF( QuatF * q ) const
{
   q->x = F32( x ) / F32(MAX_VAL);
   q->y = F32( y ) / F32(MAX_VAL);
   q->z = F32( z ) / F32(MAX_VAL);
   q->w = F32( w ) / F32(MAX_VAL);
   return *q;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:8,代码来源:tsTransform.cpp


示例2: pos

void GFXD3D9Device::setClipRect( const RectI &inRect ) 
{
	// We transform the incoming rect by the view 
   // matrix first, so that it can be used to pan
   // and scale the clip rect.
   //
   // This is currently used to take tiled screenshots.
	Point3F pos( inRect.point.x, inRect.point.y, 0.0f );
   Point3F extent( inRect.extent.x, inRect.extent.y, 0.0f );
   getViewMatrix().mulP( pos );
   getViewMatrix().mulV( extent );  
   RectI rect( pos.x, pos.y, extent.x, extent.y );

   // Clip the rect against the renderable size.
   Point2I size = mCurrentRT->getSize();

   RectI maxRect(Point2I(0,0), size);
   rect.intersect(maxRect);

   mClipRect = rect;

   F32 l = F32( mClipRect.point.x );
   F32 r = F32( mClipRect.point.x + mClipRect.extent.x );
   F32 b = F32( mClipRect.point.y + mClipRect.extent.y );
   F32 t = F32( mClipRect.point.y );

   // Set up projection matrix, 
   static Point4F pt;   
   pt.set(2.0f / (r - l), 0.0f, 0.0f, 0.0f);
   mTempMatrix.setColumn(0, pt);

   pt.set(0.0f, 2.0f/(t - b), 0.0f, 0.0f);
   mTempMatrix.setColumn(1, pt);

   pt.set(0.0f, 0.0f, 1.0f, 0.0f);
   mTempMatrix.setColumn(2, pt);

   pt.set((l+r)/(l-r), (t+b)/(b-t), 1.0f, 1.0f);
   mTempMatrix.setColumn(3, pt);

   setProjectionMatrix( mTempMatrix );

   // Set up world/view matrix
   mTempMatrix.identity();   
   setWorldMatrix( mTempMatrix );

   setViewport( mClipRect );
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:48,代码来源:gfxD3D9Device.cpp


示例3: mAcos

QuatF & QuatF::interpolate( const QuatF & q1, const QuatF & q2, F32 t )
{
   //-----------------------------------
   // Calculate the cosine of the angle:

   double cosOmega = q1.dot( q2 );

   //-----------------------------------
   // adjust signs if necessary:

   F32 sign2;
   if ( cosOmega < 0.0 )
   {
      cosOmega = -cosOmega;
      sign2 = -1.0f;
   }
   else
      sign2 = 1.0f;

   //-----------------------------------
   // calculate interpolating coeffs:

   double scale1, scale2;
   if ( (1.0 - cosOmega) > 0.00001 )
   {
      // standard case
      double omega = mAcos(cosOmega);
      double sinOmega = mSin(omega);
      scale1 = mSin((1.0 - t) * omega) / sinOmega;
      scale2 = sign2 * mSin(t * omega) / sinOmega;
   }
   else
   {
      // if quats are very close, just do linear interpolation
      scale1 = 1.0 - t;
      scale2 = sign2 * t;
   }


   //-----------------------------------
   // actually do the interpolation:

   x = F32(scale1 * q1.x + scale2 * q2.x);
   y = F32(scale1 * q1.y + scale2 * q2.y);
   z = F32(scale1 * q1.z + scale2 * q2.z);
   w = F32(scale1 * q1.w + scale2 * q2.w);
   return *this;
}
开发者ID:CouleeApps,项目名称:MBExtender,代码行数:48,代码来源:mQuat.cpp


示例4: setLastError

bool Win32RedBookDevice::getVolume(F32 * volume)
{
   if(!mAcquired)
   {
      setLastError("Device has not been acquired");
      return(false);
   }

   if(!mVolumeInitialized)
   {
      setLastError("Volume failed to initialize");
      return(false);
   }

   U32 vol = 0;
   if(mUsingMixer)
   {
      mixerGetControlDetails(mVolumeDeviceId, &mMixerVolumeDetails, MIXER_GETCONTROLDETAILSF_VALUE);
      vol = mMixerVolumeValue.dwValue;
   }
   else
      auxGetVolume(mAuxVolumeDeviceId, (unsigned long *)&vol);

   vol &= 0xffff;
   *volume = F32(vol) / 65535.f;

   setLastError("");
   return(true);
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:29,代码来源:winRedbook.cpp


示例5: LL_INFOS

/*virtual*/
void LLMediaDataClient::Responder::error(U32 status, const std::string& reason)
{
	if (status == HTTP_SERVICE_UNAVAILABLE)
	{
		F32 retry_timeout = mRequest->getRetryTimerDelay();
		
		mRequest->incRetryCount();
		
		if (mRequest->getRetryCount() < mRequest->getMaxNumRetries()) 
		{
			LL_INFOS("LLMediaDataClient") << *mRequest << " got SERVICE_UNAVAILABLE...retrying in " << retry_timeout << " seconds" << LL_ENDL;
			
			// Start timer (instances are automagically tracked by
			// InstanceTracker<> and LLEventTimer)
			new RetryTimer(F32(retry_timeout/*secs*/), this);
		}
		else {
			LL_INFOS("LLMediaDataClient") << *mRequest << " got SERVICE_UNAVAILABLE...retry count " 
				<< mRequest->getRetryCount() << " exceeds " << mRequest->getMaxNumRetries() << ", not retrying" << LL_ENDL;
		}
	}
	else {
		std::string msg = boost::lexical_cast<std::string>(status) + ": " + reason;
		LL_WARNS("LLMediaDataClient") << *mRequest << " http error(" << msg << ")" << LL_ENDL;
	}
}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:27,代码来源:llmediadataclient.cpp


示例6: ASSERT

//
// GetNearbyWalls
//
// Get walls within link distance of the given position
//
void WallObjType::GetNearbyWalls(Team *team, const Vector &p, WallObjList &list, WallObj *filter)
{
  ASSERT(WorldCtrl::MetreOnMap(p.x, p.z))

  // What range should we search in
  F32 range = F32(GetRangeStraight() + 1) * WorldCtrl::CellSize();

  // Generate a unit iterator
  UnitObjIter::Tactical i(NULL, UnitObjIter::FilterData(team, Relation::ALLY, p, range));

  UnitObj *obj;

  // Check each unit
  while ((obj = i.Next()) != NULL)
  {
    // Is this a wall
    if (WallObj *wall = Promote::Object<WallObjType, WallObj>(obj))
    {
      // Should we add it
      if (wall != filter)
      {
        list.Append(wall);
      }
    }
  }  
}
开发者ID:ZhouWeikuan,项目名称:darkreign2,代码行数:31,代码来源:wallobj.cpp


示例7: F32

void PGRAPH::ClearSurface(U32 mask) {
    // Avoid clearing empty surfaces
    if (surface.width == 0 || surface.height == 0) {
        return;
    }
    const F32 color[4] = {
        ((clear_color >> 24) & 0xFF) / 255.0f, // Red
        ((clear_color >> 16) & 0xFF) / 255.0f, // Green
        ((clear_color >>  8) & 0xFF) / 255.0f, // Blue
        ((clear_color >>  0) & 0xFF) / 255.0f, // Alpha
    };
    const F32 depth = clear_depth / F32(0xFFFFFF);
    const U08 stencil = clear_stencil;

    if (mask & RSX_CLEAR_BIT_COLOR) {
        auto* colorTarget = getColorTarget(surface.colorOffset[0]);
        cmdBuffer->cmdClearColor(colorTarget, color);
    }
    if (mask & (RSX_CLEAR_BIT_DEPTH | RSX_CLEAR_BIT_STENCIL)) {
        // TODO: Depth-exclusive or stencil-exclusive clears are unimplemented
        auto* depthTarget = getDepthStencilTarget(surface.depthOffset);
        cmdBuffer->cmdClearDepthStencil(depthTarget, depth, stencil);
    }

    // TODO: Check if cmdBuffer is empty
    cmdBuffer->finalize();
    cmdQueue->submit(cmdBuffer, fence);
    fence->wait();
    cmdBuffer->reset();
}
开发者ID:zod331,项目名称:nucleus,代码行数:30,代码来源:rsx_pgraph.cpp


示例8: F32

// Return a measure of a player's strength.
// Right now this is roughly a kill - death / kill + death ratio
// Better might be: https://secure.wikimedia.org/wikipedia/en/wiki/Elo_rating_system
F32 Statistics::getCalculatedRating()
{
   // Total kills = mKills + mFratricides (but we won't count mFratricides)
   // Counted deaths = mDeaths - mSuicides (mSuicides are included in mDeaths and we want to ignore them)
   // Use F32 here so we don't underflow with U32 math; probably not necessary
   F32 deathsDueToEnemyAction   = F32(mTotalDeaths) - F32(mTotalSuicides);
   F32 totalTotalKillsAndDeaths = F32(mTotalKills) + deathsDueToEnemyAction;

   // Initial case: you haven't killed or died -- go out and prove yourself, lad!
   if(totalTotalKillsAndDeaths == 0)
      return 0;

   // Standard case
   else   
      return ((F32)mTotalKills - deathsDueToEnemyAction) / totalTotalKillsAndDeaths;
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:19,代码来源:statistics.cpp


示例9: PROFILE_SCOPE

bool StdClientProcessList::advanceTime( SimTime timeDelta )
{
   PROFILE_SCOPE( StdClientProcessList_AdvanceTime );

   if ( doBacklogged( timeDelta ) )
      return false;
 
   bool ret = Parent::advanceTime( timeDelta );
   ProcessObject *obj = NULL;

   AssertFatal( mLastDelta >= 0.0f && mLastDelta <= 1.0f, "mLastDelta is not zero to one.");
   
   obj = mHead.mProcessLink.next;
   while ( obj != &mHead )
   {      
      if ( obj->isTicking() )
         obj->interpolateTick( mLastDelta );

      obj = obj->mProcessLink.next;
   }

   for (U32 i = 0; i < UpdateInterface::all.size(); i++)
   {
      Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);

      if (!comp->isClientObject() || !comp->isActive())
            continue;

      UpdateInterface::all[i]->interpolateTick(mLastDelta);
   }

   // Inform objects of total elapsed delta so they can advance
   // client side animations.
   F32 dt = F32(timeDelta) / 1000;

   // Update camera FX.
   gCamFXMgr.update( dt );

   obj = mHead.mProcessLink.next;
   while ( obj != &mHead )
   {      
      obj->advanceTime( dt );
      obj = obj->mProcessLink.next;
   }
   
   for (U32 i = 0; i < UpdateInterface::all.size(); i++)
   {
      Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);

      if (comp)
      {
         if (!comp->isClientObject() || !comp->isActive())
            continue;
      }

      UpdateInterface::all[i]->advanceTime(dt);
   }

   return ret;
}
开发者ID:nev7n,项目名称:Torque3D,代码行数:60,代码来源:stdGameProcess.cpp


示例10: Mesh

//
// Adjust resource display
//
void ResourceObj::AdjustResource()
{
  if (Mesh().curCycle)
  {
    Mesh().SetFrame((Mesh().curCycle->maxFrame - 1) * (1.0f - (F32(resource) * ResourceType()->GetResourceMaxInv())));
  }
}
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:10,代码来源:resourceobj.cpp


示例11: strnew

   AppIfl::AppIfl(const char * fullPath)
   {
      mIflFile = strnew(fullPath);

      // load in duration and names

      std::ifstream is;
      is.open(fullPath);

      char buffer[256];
      char name[256];
      S32 duration;
      while (is.good() && !is.eof())
      {
         is.getline(buffer,sizeof(buffer));
         S32 num = sscanf(buffer,"%s %i",name,&duration);
         if (num==1)
         {
            mNames.push_back(strnew(name));
            mDurations.push_back(AppTime(1.0f/30.0f,0));
         }
         else if (num==2)
         {
            mNames.push_back(strnew(name));
            mDurations.push_back(AppTime(F32(duration)/30.0f,0));
         }
      }
   }
开发者ID:parhelia512,项目名称:tge-152-fork,代码行数:28,代码来源:appIfl.cpp


示例12: F32

void EnergyGaugeRenderer::render(S32 energy)
{
   // Create fade
   static const F32 colors[] = {
      Colors::blue.r, Colors::blue.g, Colors::blue.b, 1,   // Fade from
      Colors::blue.r, Colors::blue.g, Colors::blue.b, 1,
      Colors::cyan.r, Colors::cyan.g, Colors::cyan.b, 1,   // Fade to
      Colors::cyan.r, Colors::cyan.g, Colors::cyan.b, 1,
   };

   GaugeRenderer::render(energy, Ship::EnergyMax, colors, GaugeBottomMargin, GaugeHeight, Ship::EnergyCooldownThreshold);

#ifdef SHOW_SERVER_SITUATION
   ServerGame *serverGame = GameManager::getServerGame();

   if((serverGame && serverGame->getClientInfo(0)->getConnection()->getControlObject()))
   {
      S32 actDiff = static_cast<Ship *>(serverGame->getClientInfo(0)->getConnection()->getControlObject())->getEnergy();
      S32 p = F32(actDiff) / Ship::EnergyMax * GaugeWidth;
      glColor(Colors::magenta);
      drawVertLine(xul + p, yul - SafetyLineExtend - 1, yul + GaugeHeight + SafetyLineExtend);

      //Or, perhaps, just this:
      //renderGauge(energy, Ship::EnergyMax, Colors::blue, Colors::cyan, GaugeBottomMargin, GaugeHeight);
   }
#endif
}
开发者ID:LibreGames,项目名称:bitfighter,代码行数:27,代码来源:GaugeRenderer.cpp


示例13: U32

  //
  // Process the recycler
  //
  void Base::Recycler::Process()
  {
    // Work out how much resource is pending from refunds
    U32 refund = 0;
    for (UnitObjList::Iterator u(&state.GetBase().GetManager().GetRefunds()); *u; ++u)
    {
      refund += U32(F32((**u)->GetResourceValue() * (**u)->UnitType()->GetRecyclePercentage()));
    }

    Object &object = state.GetBase().GetObject();
    Team *team = object.GetTeam();
    U32 resource = team->GetResourceStore();

    // Do we have less cash now than the limit ?
    if ((resource + refund) < cash)
    {
      for (NList<Type>::Iterator t(&types); *t; ++t)
      {
        const NList<UnitObj> *units = team->GetUnitObjects((*t)->type->GetNameCrc());

        if (units && units->GetCount() > (*t)->minimum)
        {
          // Order this unit to be recycled
          UnitObj *unit = units->GetHead();
          Orders::Game::ClearSelected::Generate(object);
          Orders::Game::AddSelected::Generate(object, unit);
          Orders::Game::Recycle::Generate(object);
          state.GetBase().GetManager().AddRefund(unit);
          break;
        }
      }
    }

  }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:37,代码来源:strategic_base_recycler.cpp


示例14: F32

// strait twisty beam
//
void BeamRenderPlain::Setup()
{
  // get beam rendering class
  BeamRenderPlainClass * sc = (BeamRenderPlainClass *)proto;

  F32 t = paramAnim.Current().scale;
  if (t <= 1)
  {
    offset = sc->data.vector * t;
  }
  Quaternion r = angle * rotation;

  const Vector & p0 = particle->matrix.posit;
  Vector * p = points.data, * pe = points.data + points.count - 1;
  *p++ = p0;
  Vector dof = offset * (1.0f / F32(points.count - 1)), off = dof;

  //LOG_DIAG((""))
  //LOG_DIAG((""))
  //LOG_DIAG(("p: %f,%f,%f", p->x, p->y, p->z));
  for (F32 h = 0; p < pe; p++, off += dof, r *= twist)
  {
    *p = p0 + off + r.GetRight() * sc->distance;
    //LOG_DIAG(("p: %f,%f,%f", p->x, p->y, p->z));
  }
  *p = p0 + off;
  //LOG_DIAG(("p: %f,%f,%f", p->x, p->y, p->z));
}
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:30,代码来源:beamrender_plain.cpp


示例15: ReadJoystick

bool ReadJoystick(F32 axes[MaxJoystickAxes], U32 &buttonMask, U32 &hatMask)
{
   if(!gJoystickInit)
      return false;

   S32 i;
   for(i = 0; i < MaxJoystickAxes; i++)
   {
      ControllerElement *e = &gController.axes[i];
      S32 elementValue = getElementValue(e);
      S32 diff = e->maxValue - e->minValue;
      if(diff != 0)
      {
         axes[i] = (elementValue - e->minValue) * 2 / F32(diff);
         axes[i] -= 1;
      }
      else
         axes[i] = 0;
   }

   buttonMask = 0;
   for(i = 0; i < gController.buttons.size(); i++)
   {
      ControllerElement *e = &gController.buttons[i];
      S32 value = getElementValue(e);
      if(value)
         buttonMask |= (1 << i);
   }
   return true;
}
开发者ID:HwakyoungLee,项目名称:opentnl,代码行数:30,代码来源:osxInput.cpp


示例16: F32

SFXBuffer* SFXProfile::_createBuffer()
{
   SFXBuffer* buffer = 0;
   
   // Try to create through SFXDevie.
   
   if( !mFilename.isEmpty() && SFX )
   {
      buffer = SFX->_createBuffer( mFilename, mDescription );
      if( buffer )
      {
         #ifdef TORQUE_DEBUG
         const SFXFormat& format = buffer->getFormat();
         Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
            mDescription->mIsStreaming ? "Streaming" : "Loaded", mFilename.c_str(),
            format.getChannels(),
            format.getSamplesPerSecond() / 1000,
            F32( buffer->getDuration() ) / 1000.0f,
            format.getDataLength( buffer->getDuration() ) / 1024 );
         #endif
      }
   }
   
   // If that failed, load through SFXResource.
   
   if( !buffer )
   {
      Resource< SFXResource >& resource = getResource();
      if( resource != NULL && SFX )
      {
         #ifdef TORQUE_DEBUG
         const SFXFormat& format = resource->getFormat();
         Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
            mDescription->mIsStreaming ? "Streaming" : "Loading", resource->getFileName().c_str(),
            format.getChannels(),
            format.getSamplesPerSecond() / 1000,
            F32( resource->getDuration() ) / 1000.0f,
            format.getDataLength( resource->getDuration() ) / 1024 );
         #endif

         ThreadSafeRef< SFXStream > sfxStream = resource->openStream();
         buffer = SFX->_createBuffer( sfxStream, mDescription );
      }
   }

   return buffer;
}
开发者ID:belzilep,项目名称:Torque3D,代码行数:47,代码来源:sfxProfile.cpp


示例17: switch

    //
    // Image::Notify
    //
    void Image::Notify(U32 crc)
    {
      switch (crc)
      {
        case 0xC3AC47E6: // "Render::PostIFace2"
        {
          F32 curr = Simulate();

          // Calculate screen rectangle
          const ClipRect &rc = cineViewPort;
          ClipRect newRc;

          if (absolute)
          {
            if (absPos.x < 0)
            {
              newRc.p0.x = rc.p1.x - absSize.x + absPos.x;
            }
            else
            {
              newRc.p0.x = rc.p0.x + absPos.x;
            }

            if (absPos.y < 0)
            {
              newRc.p0.y = rc.p1.y - absSize.y + absPos.y;
            }
            else
            {
              newRc.p0.y = rc.p0.y + absPos.y;
            }

            newRc.p1 = newRc.p0 + absSize;
          }
          else
          {
            newRc.p0.x = rc.p0.x + Utils::FtoL(pos.x * F32(rc.Width()));
            newRc.p0.y = rc.p0.y + Utils::FtoL(pos.y * F32(rc.Height()));
            newRc.p1.x = rc.p0.x + Utils::FtoL((pos.x + size.x) * F32(rc.Width()));
            newRc.p1.y = rc.p0.y + Utils::FtoL((pos.y + size.y) * F32(rc.Height()));
          }
          IFace::RenderRectangle(newRc, clr, &texture, curr * IFace::data.alphaScale);

          return;
        }
      }
    }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:50,代码来源:viewer_action.cpp


示例18: v

void AtlasOldMesher::updateBounds()
{
   // Reset our bounds!
   mBounds.minExtents.set(F32_MAX, F32_MAX, F32_MAX);
   mBounds.maxExtents.set(-F32_MAX, -F32_MAX, -F32_MAX);

   // First, iterate over our verts and our bounds.
   for(S32 i=0; i<mVerts.size(); i++)
   {
      S16 z;
      if(mVerts[i].special)
         z = mVerts[i].z;
      else
         z = mHeight->sampleRead(mVerts[i].pos);

      Point3F v(  mVerts[i].pos.x * mHeight->mSampleSpacing,
                  mVerts[i].pos.y * mHeight->mSampleSpacing,
                  z * mHeight->mVerticalScale);

      if(i)
      {
         mBounds.maxExtents.setMax(v);
         mBounds.minExtents.setMin(v);

         if(z < mMinZ) mMinZ = z;
         if(z > mMaxZ) mMaxZ = z;
      }
      else
      {
         mMaxZ = mMinZ = z;
         mBounds.maxExtents = mBounds.minExtents = v;
      }
   }

   // Calculate quantization for compression.
   Point3F boxExtents(mBounds.len_x() / 2.f, mBounds.len_y() / 2.f, mBounds.len_z() / 2.f);
   boxExtents.setMax(Point3F(1, 1, 1)); // Make sure we don't bottom out...

   // Use (1 << 14) values in both positive and negative
   // directions.  Wastes just under 1 bit, but the total range
   // is [-2^14, 2^14], which is 2^15+1 values.  This is good --
   // fits nicely w/ 2^N+1 dimensions of binary-triangle-tree
   // vertex locations.
   mCompressionFactor.x = F32(1<<14) / boxExtents.x;
   mCompressionFactor.y = F32(1<<14) / boxExtents.y;
   mCompressionFactor.z = F32(1<<14) / boxExtents.z;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:47,代码来源:atlasOldMesher.cpp


示例19: ejectionAxis

//----------------------------------------------------------------------------
// Create ring
//----------------------------------------------------------------------------
SplashRing Splash::createRing()
{
   SplashRing ring;
   U32 numPoints = mDataBlock->numSegments + 1;

   Point3F ejectionAxis( 0.0, 0.0, 1.0 );

   Point3F axisx;
   if (mFabs(ejectionAxis.z) < 0.999f)
      mCross(ejectionAxis, Point3F(0, 0, 1), &axisx);
   else
      mCross(ejectionAxis, Point3F(0, 1, 0), &axisx);
   axisx.normalize();

   for( U32 i=0; i<numPoints; i++ )
   {
      F32 t = F32(i) / F32(numPoints);

      AngAxisF thetaRot( axisx, mDataBlock->ejectionAngle * (M_PI / 180.0));
      AngAxisF phiRot(   ejectionAxis, t * (M_PI * 2.0));

      Point3F pointAxis = ejectionAxis;

      MatrixF temp;
      thetaRot.setMatrix(&temp);
      temp.mulP(pointAxis);
      phiRot.setMatrix(&temp);
      temp.mulP(pointAxis);

      Point3F startOffset = axisx;
      temp.mulV( startOffset );
      startOffset *= mDataBlock->startRadius;

      SplashRingPoint point;
      point.position = getPosition() + startOffset;
      point.velocity = pointAxis * mDataBlock->velocity;

      ring.points.push_back( point );
   }

   ring.color = mDataBlock->colors[0];
   ring.lifetime = mDataBlock->ringLifetime;
   ring.elapsedTime = 0.0;
   ring.v = mDataBlock->texFactor * mFmod( mElapsedTime, 1.0 );

   return ring;
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:50,代码来源:splash.cpp


示例20: int

//--------------------------------------------------------------------------
/// Function to draw a set of boxes blending throughout an array of colors
void GuiColorPickerCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, U8 numColors, ColorI *colors)
{

   GFX->setStateBlock(mStateBlock);
   
   S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x + 4;
   S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y + 4;
   
   // Calculate increment value
   S32 x_inc = int(mFloor((r - l) / F32(numColors-1)));
   S32 y_inc = int(mFloor((b - t) / F32(numColors-1)));

   for( U16 i = 0;i < numColors - 1; i++ ) 
   {
      // This is not efficent, but then again it doesn't really need to be. -pw
      PrimBuild::begin( GFXTriangleFan, 4 );

      if (!vertical)  // Horizontal (+x)
      {
         // First color
         PrimBuild::color( colors[i] );
         PrimBuild::vertex2i( l, t );
         PrimBuild::vertex2i( l, b );

         // Second color
         PrimBuild::color( colors[i+1] );
         PrimBuild::vertex2i( l + x_inc, b );
         PrimBuild::vertex2i( l + x_inc, t );
         l += x_inc;
      }
      else  // Vertical (+y)
      {
         // First color
         PrimBuild::color( colors[i] );
         PrimBuild::vertex2i( l, t );
         PrimBuild::vertex2i( r, t );

         // Second color
         PrimBuild::color( colors[i+1] );
         PrimBuild::vertex2i( r, t + y_inc );
         PrimBuild::vertex2i( l, t + y_inc );
         t += y_inc;
      }
      PrimBuild::end();
   }
}
开发者ID:practicing01,项目名称:Torque3D,代码行数:48,代码来源:guiColorPicker.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ F77_CALL函数代码示例发布时间:2022-05-30
下一篇:
C++ F3函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap