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


C++ FLOAT函数代码示例

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


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

示例1: SetKeyboardState

void CLcInputA::OnReset()
{
	// 키보드는 전부 0
	SetKeyboardState(m_KeyCur);
	
	memset(m_KeyCur, 0, sizeof m_KeyCur);
	memset(m_KeyOld, 0, sizeof m_KeyOld);
	memset(m_KeyMap, 0, sizeof m_KeyMap);
	
	memset(m_BtnCur, 0, sizeof m_BtnCur);
	memset(m_BtnOld, 0, sizeof m_BtnOld);
	memset(m_BtnMap, 0, sizeof m_BtnMap);

	// 마우스는 현재 위치 유지
	m_fWheel = 0;

	POINT	pt;

	::GetCursorPos(&pt);
	::ScreenToClient( m_hWnd, &pt);

	m_vMsCur[0] = FLOAT(pt.x);
	m_vMsCur[1] = FLOAT(pt.y);
	m_vMsCur[2] = 0.f;

	memcpy(m_vMsOld, m_vMsCur, sizeof m_vMsCur);
	memset(m_vDelta,        0, sizeof m_vDelta);
}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:28,代码来源:LnInputA.cpp

示例2: InitSHTables

/** Initializes the tables used to calculate SH values. */
static INT InitSHTables()
{
	INT	L = 0,
		M = 0;

	for(INT BasisIndex = 0;BasisIndex < MAX_SH_BASIS;BasisIndex++)
	{
		BasisL[BasisIndex] = L;
		BasisM[BasisIndex] = M;

		NormalizationConstants[BasisIndex] = appSqrt(
			(FLOAT(2 * L + 1) / FLOAT(4 * PI)) *
			(FLOAT(Factorial(L - Abs(M))) / FLOAT(Factorial(L + Abs(M))))
			);

		if(M != 0)
			NormalizationConstants[BasisIndex] *= appSqrt(2.f);

		M++;
		if(M > L)
		{
			L++;
			M = -L;
		}
	}

	return 0;
}
开发者ID:LiuKeHua,项目名称:colorful-engine,代码行数:29,代码来源:SHMath.cpp

示例3: vcEye

INT	CMain::Init()
{
	// Input »ý¼º
	if(LC_FAILED(LcxEnt_CreateInput(NULL, &m_pInput, m_hWnd)))
		return LC_EFAIL;


	// Camera »ý¼º
	if(LC_FAILED(LcxEnt_CreateCamera(LCXCMD_CAMERA_3D, &m_pCam)))
		return LC_EFAIL;



	LCXVECTOR3	vcEye (30, -100, 30);
	LCXVECTOR3	vcLook(30,   0,  0);
	LCXVECTOR3	vcUp  ( 0,   0,  1);
	m_pCam->SetupParamView( &vcEye, &vcLook, &vcUp);

	FLOAT	fFov = LCXToRadian(45.0F);
	FLOAT	fScnW= FLOAT(m_nScnW);
	FLOAT	fScnH= FLOAT(m_nScnH);
	FLOAT	fNear= 1.0F;
	FLOAT	fFar = 5000.0F;
	m_pCam->SetupParamProj(fFov, fScnW, fScnH, fNear, fFar);


	if(LC_FAILED(LcxEnt_CreateEntity(LCXCMD_ENTITY_AXIS, &m_pXYZ)))
		return LC_EFAIL;


	if(LC_FAILED(LcxEnt_CreateEntity(LCXCMD_ENTITY_GRID, &m_pGrid)))
		return LC_EFAIL;

	return LC_OK;
}
开发者ID:GALICSOFT,项目名称:glc220,代码行数:35,代码来源:Main.cpp

示例4:

int D3DVertexBufferCache::FindBestEntry(int size)
{
   // Search for buffer that fits in borders
   for (int i = 0; i < _cache.Length(); i++)
   {
      const int vs = _cache[i].size;
      if (size >= (vs - FLOAT(vs) * size_border_low) && size <= vs)
         return i;
   }
   bool less_than_all = true;
   for (int i = 0; i < _cache.Length(); i++)
   {
      const int vs = _cache[i].size;
      if (size >= (vs - FLOAT(vs) * size_border_low))
         less_than_all = false;
   }
   // Requested size is too small to reuse in any buffer
   if (less_than_all)
      return -1;
   // Search for buffer that can be reallocated
   for (int i = 0; i < _cache.Length(); i++)
   {
      const int vs = _cache[i].size;
      if (size <= (vs + FLOAT(vs) * size_border_high))
         return i;
   }
   // No buffer can be reused or reallocated, create a new one
   return -1;
}
开发者ID:Limsik,项目名称:e17,代码行数:29,代码来源:evas_direct3d_vertex_buffer_cache.cpp

示例5: FLOAT

void CGpApp::ShieldPulse()
{
	m_ShieldTransparency = FLOAT(m_ShieldEnergy) / FLOAT(SHIELDENERGYmax);



	DOUBLE TimeCur = LcSys_GetTickCount();

	if(TimeCur < (m_ShieldTimeDelta+ m_ShieldTimeBgn))
		return;


	m_ShieldTimeBgn = TimeCur;


	m_ShieldRatio += m_ShieldExtend * 0.02F;

	if(m_ShieldRatio >= SHIELDRATIOmax)
	{
		m_ShieldExtend = SHIELDRATIOmax;
		m_ShieldExtend = -1.F;
	}

	if(m_ShieldRatio < SHIELDRATIOmin)
	{
		m_ShieldExtend = SHIELDRATIOmin;
		m_ShieldExtend = +1.F;
	}
}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:29,代码来源:GpApp3.cpp

示例6: FLOAT

void HWCDisplayExternal::ApplyScanAdjustment(hwc_rect_t *display_frame) {
  if (display_intf_->IsUnderscanSupported()) {
    return;
  }

  // Read user defined width and height ratio
  int width = 0, height = 0;
  HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_width", &width);
  float width_ratio = FLOAT(width) / 100.0f;
  HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_height", &height);
  float height_ratio = FLOAT(height) / 100.0f;

  if (width_ratio == 0.0f ||  height_ratio == 0.0f) {
    return;
  }

  uint32_t panel_width = 0;
  uint32_t panel_height = 0;
  GetPanelResolution(&panel_width, &panel_height);

  if (panel_width == 0 || panel_height == 0) {
    DLOGV("Invalid panel dimensions (%d, %d)", panel_width, panel_height);
    return;
  }

  int x_offset = INT((FLOAT(panel_width) * width_ratio) / 2.0f);
  int y_offset = INT((FLOAT(panel_height) * height_ratio) / 2.0f);

  display_frame->left = display_frame->left + x_offset;
  display_frame->top = display_frame->top + y_offset;
  display_frame->right = display_frame->right - x_offset;
  display_frame->bottom = display_frame->bottom - y_offset;
}
开发者ID:myfluxi,项目名称:android_hardware_qcom_display,代码行数:33,代码来源:hwc_display_external.cpp

示例7: InitTris

static void InitTris(void)
{
  INDEX iR, iC;
  INDEX ctVx = _ctR*_ctC;
  _avtx.Push(ctVx);
  _atex.Push(ctVx);
  _acol.Push(ctVx);
  for( iR=0; iR<_ctR; iR++) {
    for( iC=0; iC<_ctC; iC++) {
      INDEX ivx = iR*_ctC+iC;
      _avtx[ivx].x =  FLOAT(iC) / _ctC*4 -2.0f;
      _avtx[ivx].y = -FLOAT(iR) / _ctR*4 +2.0f;
      _avtx[ivx].z = -1.0f;
      _atex[ivx].st.s = (iC+iR) % 2;
      _atex[ivx].st.t = (iR)    % 2;
      _acol[ivx].ul.abgr = 0xFFFFFFFF;
    }
  }

  INDEX ctTri = (_ctR-1)*(_ctC-1)*2;
  _aiElements.Push(ctTri*3);
  for( iR=0; iR<_ctR-1; iR++) {
    for( iC=0; iC<_ctC-1; iC++) {
      INDEX iq = iR*(_ctC-1)+iC;
      _aiElements[iq*6+0] = (iR+1) * _ctC + (iC+0);
      _aiElements[iq*6+1] = (iR+1) * _ctC + (iC+1);
      _aiElements[iq*6+2] = (iR+0) * _ctC + (iC+0);
      _aiElements[iq*6+3] = (iR+0) * _ctC + (iC+0);
      _aiElements[iq*6+4] = (iR+1) * _ctC + (iC+1);
      _aiElements[iq*6+5] = (iR+0) * _ctC + (iC+1);
    }
  }
}
开发者ID:ptitSeb,项目名称:Serious-Engine,代码行数:33,代码来源:Benchmark.cpp

示例8: cm_float_atan2

void
cm_float_atan2(unsigned argc, obj_t args)
{
  obj_t recvr = CAR(args);
  
  m_float_new(consts.cl._float, atan2l(FLOAT(recvr)->val, FLOAT(CAR(CDR(args)))->val));
}
开发者ID:hpersh,项目名称:ool2,代码行数:7,代码来源:math.c

示例9: FLOAT

// convert to human-friendly format
void CMappingDefinition::ToUI(CMappingDefinitionUI &mdui) const
{
  // make a copy of parameters
  FLOAT fUoS = md_fUoS;
  FLOAT fUoT = md_fUoT;
  FLOAT fVoS = md_fVoS;
  FLOAT fVoT = md_fVoT;

  // find size of mapping vectors
  FLOAT fUSize = FLOAT(sqrt(fUoS*fUoS+fUoT*fUoT));
  FLOAT fVSize = FLOAT(sqrt(fVoS*fVoS+fVoT*fVoT));

  // find rotation of both vectors
  ANGLE aURot = -(ATan2(fVoT, fVoS)-90.0f);
  ANGLE aVRot = -(ATan2(fUoT, fUoS));

  // use the found values
  Snap(aURot, 0.001f);
  Snap(aVRot, 0.001f);
  mdui.mdui_aURotation= NormalizeAngle(aURot);
  mdui.mdui_aVRotation= NormalizeAngle(aVRot);
  mdui.mdui_fUStretch = 1/fUSize;
  mdui.mdui_fVStretch = 1/fVSize;
  mdui.mdui_fUOffset  = md_fUOffset;
  mdui.mdui_fVOffset  = md_fVOffset;
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:27,代码来源:TextureMapping.cpp

示例10: cordic_calc_iq

/*
 * cordic_calc_iq() - calculates the i/q coordinate for given angle
 *
 * theta: angle in degrees for which i/q coordinate is to be calculated
 * coord: function output parameter holding the i/q coordinate
 */
struct cordic_iq cordic_calc_iq(s32 theta)
{
	struct cordic_iq coord;
	s32 angle, valtmp;
	unsigned iter;
	int signx = 1;
	int signtheta;

	coord.i = CORDIC_ANGLE_GEN;
	coord.q = 0;
	angle = 0;

	theta = FIXED(theta);
	signtheta = (theta < 0) ? -1 : 1;
	theta = ((theta + FIXED(180) * signtheta) % FIXED(360)) -
		FIXED(180) * signtheta;

	if (FLOAT(theta) > 90) {
		theta -= FIXED(180);
		signx = -1;
	} else if (FLOAT(theta) < -90) {
		theta += FIXED(180);
		signx = -1;
	}

	for (iter = 0; iter < CORDIC_NUM_ITER; iter++) {
		if (theta > angle) {
			valtmp = coord.i - (coord.q >> iter);
			coord.q += (coord.i >> iter);
			angle += arctan_table[iter];
		} else {
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:37,代码来源:cordic.c

示例11: RenderMessagePicture

void RenderMessagePicture(CDrawPort *pdp)
{
  CCompMessage &cm = _acmMessages[_iActiveMessage];
  // try to
  try {
    // load image
    _toPicture.SetData_t(cm.cm_fnmPicture);
    ((CTextureData*)_toPicture.GetData())->Force(TEX_CONSTANT);
  // if failed
  } catch(char *strError) {
    // report error
    CPrintF("Cannot load '%s':\n%s\n", (CTString&)cm.cm_fnmPicture, strError);
    // do nothing
    return;
  }

  // get image and box sizes
  PIX pixImgSizeI = _toPicture.GetWidth();
  PIX pixImgSizeJ = _toPicture.GetHeight();
  PIXaabbox2D boxPic(PIX2D(_pixMarginI, _pixMarginJ),
      PIX2D(_boxMsgImage.Size()(1)-_pixMarginI, _boxMsgImage.Size()(2)-_pixMarginJ));
  PIX pixBoxSizeI = boxPic.Size()(1);
  PIX pixBoxSizeJ = boxPic.Size()(2);
  PIX pixCenterI = _boxMsgImage.Size()(1)/2;
  PIX pixCenterJ = _boxMsgImage.Size()(2)/2;
  // find image stretch to fit in box
  FLOAT fStretch = Min(FLOAT(pixBoxSizeI)/pixImgSizeI, FLOAT(pixBoxSizeJ)/pixImgSizeJ);
  // draw the image
  pdp->PutTexture(&_toPicture,
    PIXaabbox2D(
      PIX2D(pixCenterI-pixImgSizeI*fStretch/2, pixCenterJ-pixImgSizeJ*fStretch/2),
      PIX2D(pixCenterI+pixImgSizeI*fStretch/2, pixCenterJ+pixImgSizeJ*fStretch/2)));
}
开发者ID:angelog,项目名称:Rockets-Forever,代码行数:33,代码来源:Computer.cpp

示例12: _add

static obj_ptr _add(obj_ptr args, obj_ptr env)
{
    obj_ptr res = MKINT(0);

    for (; CONSP(args); args = CDR(args))
    {
        obj_ptr arg = CAR(args);

        if (INTP(arg))
        {
            if (FLOATP(res))
                FLOAT(res) += (double)INT(arg);
            else
                INT(res) += INT(arg);
        }
        else if (FLOATP(arg))
        {
            if (INTP(res))
            {
                int n = INT(res);
                res->type = TYPE_FLOAT;
                FLOAT(res) = (double)n;

            }
            FLOAT(res) += FLOAT(arg);
        }
        else
        {
            res = MKERROR(MKSTRING("Expected a number in +"), arg);
            break;
        }
    }

    return res;
}
开发者ID:poschengband,项目名称:emrys,代码行数:35,代码来源:c-global-env.c

示例13: memcpy

INT CLcInputA::FrameMove()
{
	INT		i=0;
	POINT	pt;
	SHORT	Val = 0;

	memcpy(m_KeyOld, m_KeyCur, sizeof m_KeyOld);
	memcpy(m_BtnOld, m_BtnCur, sizeof m_BtnOld);
	memcpy(m_vMsOld, m_vMsCur, sizeof m_vMsOld);

	memset(m_KeyCur,		0, sizeof m_KeyCur);
	memset(m_BtnCur,		0, sizeof m_BtnCur);
	memset(m_KeyMap,		0, sizeof m_KeyMap);
	memset(m_BtnMap,		0, sizeof m_BtnMap);


	HWND hWnd = GetActiveWindow();

	if(!m_hWnd || m_hWnd != hWnd)
		return 0;

	for(i=0; i<256; ++i)
	{
		Val = GetAsyncKeyState(i) & 0x8000;
		m_KeyCur[i] = (Val)? 1: 0;
	
		
		INT nOld = m_KeyOld[i];
		INT nCur = m_KeyCur[i];

		if		(0 == nOld && 1 ==nCur)	m_KeyMap[i] = INPUTST_DOWN;		// Down
		else if	(1 == nOld && 0 ==nCur)	m_KeyMap[i] = INPUTST_UP;		// Up
		else if	(1 == nOld && 1 ==nCur)	m_KeyMap[i] = INPUTST_PRESS;	// Press
	}

	m_BtnMap[0] = m_KeyMap[VK_LBUTTON];
	m_BtnMap[1] = m_KeyMap[VK_RBUTTON];
	m_BtnMap[2] = m_KeyMap[VK_MBUTTON];


	::GetCursorPos(&pt);
	::ScreenToClient( m_hWnd, &pt);
	
	m_vMsCur[0] = FLOAT(pt.x);
	m_vMsCur[1] = FLOAT(pt.y);

	if(-786420000.f<m_vMsCur[2] && m_vMsCur[2] <786420000.f)
		m_vMsCur[2] += m_fWheel;
	

	m_vDelta[0] = m_vMsCur[0] - m_vMsOld[0];
	m_vDelta[1] = m_vMsCur[1] - m_vMsOld[1];
	m_vDelta[2] = m_vMsCur[2] - m_vMsOld[2];

	m_fWheel	= 0.f;

	return 0;
}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:58,代码来源:LnInputA.cpp

示例14: main

int main()
{
	Init();
	
	
	CustomKernel mandelbrot;
	MODULE_INT_START(mandelbrot)
	MOUDLE_INPUT_FLOAT(x)
	MOUDLE_INPUT_FLOAT(y)
	MODULE_INPUT_INT(maxItt)
	MODULE_MAIN
	FLOAT(a = 0.0f)
	FLOAT(b = 0.0f)
	INT(i = 0)
	INT(j = 0)
	WHILE(i < maxItt)
	BEGIN
		IF( a * a + b * b > 4)
		BEGIN
			STATEMENT(j = 1)
			BREAK
		END
		FLOAT(aTemp = a)
		STATEMENT(a = a * a - b * b + x)
		STATEMENT(b = 2 * aTemp * b + y)
		STATEMENT(i++)
	END
	MODULE_RETURN(i)
	MODULE_END
	
	
	CustomKernel mandelbrotRun;
	KERNEL_START(mandelbrotRun)
	KERNEL_INPUT_INT(itt)
	INCLUDE(mandelbrot)
	KERNEL_MAIN
	INT(val)
	FLOAT(x = (MYCOORD.x - 0.5) * 4)
	FLOAT(y = (MYCOORD.y - 0.5) * 4)
	CALL(val, mandelbrot, x, y, itt)
	KERNEL_OUTPUT(1.5 / float(val))
	KERNEL_END
	

	DeviceVector dVOut(1024, 1024);
	HostVector hVOut;
	
	mandelbrotRun.Input(500);
	mandelbrotRun.Output(dVOut);
	mandelbrotRun.Execute();
	
	hVOut = dVOut;
	ImageProcessing::SaveImageFile("mandelbrot.bmp", hVOut);
	
	getchar();
	return 0;
}
开发者ID:roliver,项目名称:glVectorCompute,代码行数:57,代码来源:mandelbrotTest.cpp

示例15: GetSliderBox

static PIXaabbox2D GetSliderBox(INDEX iFirst, INDEX iVisible, INDEX iTotal,
  PIXaabbox2D boxFull)
{
  FLOAT fSize = ClampUp(FLOAT(iVisible)/iTotal, 1.0f);
  PIX pixFull = boxFull.Size()(2);
  PIX pixSize = PIX(pixFull*fSize);
  pixSize = ClampDn(pixSize, boxFull.Size()(1));
  PIX pixTop = pixFull*(FLOAT(iFirst)/iTotal)+boxFull.Min()(2);
  PIX pixI0 = boxFull.Min()(1);
  PIX pixI1 = boxFull.Max()(1);
  return PIXaabbox2D(PIX2D(pixI0, pixTop), PIX2D(pixI1, pixTop+pixSize));
}
开发者ID:angelog,项目名称:Rockets-Forever,代码行数:12,代码来源:Computer.cpp


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