您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetWidth函数代码示例

51自学网 2021-06-01 21:17:49
  C++
这篇教程C++ GetWidth函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Stretch

 void Stretch(ConstImageBuffer src) {   Stretch(0, 0, GetWidth(), GetHeight(),           src, 0, 0, src.width, src.height); }
开发者ID:XCSoar,项目名称:XCSoar,代码行数:4,


示例2: m_Width

GeometryTerrain::GeometryTerrain(int size, int patch_size, int num_hills, float smoothness, int smooth_passes ): m_Width(size),   m_Length(size),  m_patchSize(patch_size){	if(patch_size < 2) patch_size = 2;	if(patch_size > size) patch_size = size;	m_pHeight	= new float*[m_Width+1];	m_fOffsetX = 1.0f;	m_fOffsetY = 1.0f;	m_fOffsetZ = 1.0f;	for(int i = 0; i <= m_Length; i++)	{				m_pHeight[i] = new float[m_Width+1];		memset(m_pHeight[i], 0, sizeof(float)*(m_Length+1));	}	m_pVertices = NULL;	m_nVertexCount = ((unsigned int)GetWidth()+1)*((unsigned int)GetLength()+1);	//memset(m_pVertices, 0, m_nVertexCount);	//memset(m_pNormals, 0, m_nVertexCount);	m_pVertices		= new flx_Vertex[m_nVertexCount];	m_pTexCoords	= new flx_TexCoord[m_nVertexCount];	m_pNormals		= new flx_Normal[m_nVertexCount];	//Add some random Hills and smooth it	generateTerrain(num_hills);	for(int i = 0; i < smooth_passes; ++i)		smoothTerrain(smoothness);	int deg_x = 0, deg_z = 0;	for(int z = 0; z <= GetLength(); z++)	{		for(int x = 0; x <= GetWidth(); x++)		{			//fill Vertex array with data			m_pVertices[x + z * (GetWidth()+1)].x = (float)x * m_fOffsetX;			m_pVertices[x + z * (GetWidth()+1)].y = getHeight(x, z);			m_pVertices[x + z * (GetWidth()+1)].z = (float)z * m_fOffsetZ;			//fill TexCoord array with data			m_pTexCoords[x + z * (GetWidth()+1)].u = (float)((float)x/(GetWidth()+1));			m_pTexCoords[x + z * (GetWidth()+1)].v = (float)((float)z/(GetWidth()+1));		}	}	//Create Indices	for(int z = 0; z < GetLength()-1; z++)	{		//Even rows move left to right		if(z % 2 == 0)		{			int x;			for(x = 0; x < GetWidth(); x++)			{				m_Indices.push_back( x + (z * GetWidth()) );				m_Indices.push_back( x + (z * GetWidth()) + GetWidth() );			}			if(z != GetLength() - 2 ) 				m_Indices.push_back( --x + (z * GetWidth()) );		}		else		{			//odd rows move right to left			int x;			for(x = GetWidth() -1; x >= 0; x--)			{				m_Indices.push_back( x + (z * GetWidth()) );				m_Indices.push_back( x + (z * GetWidth()) + GetWidth() );			}			if(z != GetLength() - 2 ) 				m_Indices.push_back( ++x + (z * GetWidth()) );		}	}		//Fill the buffers with data	//VertexBuffer.setElementList(m_pVertices, m_nVertexCount);	//TexCoordBuffer.setElementList(m_pTexCoords, m_nVertexCount);	//...and calculate the Normals	computeNormals();	//Buffers ready to bind!	//NormalBuffer.build(GL_ARRAY_BUFFER, GL_NORMAL_ARRAY);	//VertexBuffer.build(GL_ARRAY_BUFFER, GL_VERTEX_ARRAY);	//TexCoordBuffer.build(GL_ARRAY_BUFFER, GL_TEXTURE_COORD_ARRAY);		buildPatches(0);	//delete [] m_pVertices; m_pVertices = NULL;//.........这里部分代码省略.........
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:101,


示例3: getBytesRequired

 long ImageLoader::GetBytesPerLine () {     return getBytesRequired(GetWidth(), _myEncoding); }
开发者ID:artcom,项目名称:y60,代码行数:4,


示例4: shadowMapTexture

void GeometryTerrain::computeLightmap(Vector3 _vlightSource, bool update){	bool bIntegrateNormals = false;	std::vector<GLubyte> shadowMapTexture(GetWidth()*GetWidth()*4); 	float maxHeight = -99999.0f;	for(int z =0; z <= GetLength(); ++z)		for(int x = 0; x <= GetWidth(); ++x)			maxHeight = max(getHeight(x,z), maxHeight);	for(int z =0; z <= GetLength(); ++z)	{		for(int x = 0; x <= GetWidth(); ++x)		{			float ambientLight = 255;			Ray lightRay(Vector3(x, getHeight(x, z), z), _vlightSource );			Vector3 current_ray_pos(Vector3(x, getHeight(x, z), z));			Vector3 direction_to_sun = lightRay.m_v3Direction.normalize();			int numRayHits = 0;			while(!(current_ray_pos.x <= 0 || current_ray_pos.x >= GetWidth() || current_ray_pos.z <= 0 || current_ray_pos.z >= GetWidth() ))			{				if(current_ray_pos.y > maxHeight) break;				// Is the terrain blocking the ray at this point?				if(getHeight((int)floor(current_ray_pos.x), (int)floor(current_ray_pos.z)) > current_ray_pos.y)				{					numRayHits++;					break;				}				//light still traveling...				current_ray_pos += direction_to_sun;				}			float ambientLightNormals = 0;			if(bIntegrateNormals)			{				Vector3 n(					m_pNormals[x+z * (GetWidth()+1)].x, 					m_pNormals[x+z * (GetWidth()+1)].y, 					m_pNormals[x+z * (GetWidth()+1)].z					);				ambientLightNormals = 0.5*( 1.0f + dot(n.normalize(), direction_to_sun) );				if(ambientLightNormals > 1.0f) ambientLightNormals = 1.0f;				if(ambientLightNormals < 0.0f) ambientLightNormals = 0.0f;			}			if(numRayHits > 0)			{					//ambientLight = (current_ray_pos - Vector3(x,getHeight(x,z),z)).magnitude() - ambientLightNormals * 255;					ambientLight = 170;					if(ambientLight > 255) ambientLight = 255;					if(ambientLight < 170) ambientLight = 170;			}			int index = (x + z * GetWidth()) * 3;				for (int i = 0; i < 3; ++i) {					shadowMapTexture[index + i] = (GLubyte)ambientLight;				}		}	}		for(int z =0; z <= GetLength(); ++z)	{		for(int x = 0; x <= GetWidth(); ++x)		{			int factor = 2;			ColorOGL colCurrent;			colCurrent.m_fRed = shadowMapTexture[(x + z * GetWidth()) * 3 + 0];			colCurrent.m_fGreen = shadowMapTexture[(x + z * GetWidth()) * 3 + 1];			colCurrent.m_fBlue = shadowMapTexture[(x + z * GetWidth()) * 3 + 2];			ColorOGL colT;			ColorOGL colD;			ColorOGL colL;			ColorOGL colR;			if(shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 0) &&				shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 1) &&				shadowMapTexture.size() > ((x + (z+factor) * GetWidth()) * 3 + 2)				)			{				colT.m_fRed = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 0];				colT.m_fGreen = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 1];				colT.m_fBlue = shadowMapTexture[(x + (z+factor) * GetWidth()) * 3 + 2];			}			if(shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 0) &&				shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 1) &&				shadowMapTexture.size() > ((x + (z-factor) * GetWidth()) * 3 + 2)				)			{				colD.m_fRed = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 0];				colD.m_fGreen = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 1];				colD.m_fBlue = shadowMapTexture[(x + (z-factor) * GetWidth()) * 3 + 2];			}//.........这里部分代码省略.........
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:101,


示例5: Vector3

Vector3 GeometryTerrain::getNormal(int x, int z) {	return Vector3(m_pNormals[x+z * (GetWidth()+1)].x,m_pNormals[x+z * (GetWidth()+1)].y,m_pNormals[x+z * (GetWidth()+1)].z);}
开发者ID:grimtraveller,项目名称:fluxengine,代码行数:4,


示例6: SetPos

void CUIQuestRestore::ResetPosition( PIX pixMinI, PIX pixMinJ, PIX pixMaxI, PIX pixMaxJ ){	SetPos( ( pixMaxI + pixMinI - GetWidth() ) / 2 , ( pixMaxJ + pixMinJ - GetHeight() ) / 2  );}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:4,


示例7: CCreate_Rock_Fall_Message

void CEarthBoss::Update(float fElapsedTime){	CEnemy::Update(fElapsedTime);	if (m_pEState->GetState() == EntityState::DEAD)	{		return;	}	m_fUpdateOldPos += fElapsedTime;	if(m_nCoolDown > 0)		m_nCoolDown -= fElapsedTime;	if( m_fPunchCoolDown > 0.0f  && m_bPunching == true)		m_fPunchCoolDown -= fElapsedTime;	else	{		m_fPunchCoolDown = 2.5f;		m_bPunching = false;	}	if (m_fSpecialTimer > 0.0f)		m_fSpecialTimer -= fElapsedTime;	else	{		CCreate_Rock_Fall_Message* pMsg = new CCreate_Rock_Fall_Message();		CSGD_MessageSystem::GetInstance()->SendMsg(pMsg);		pMsg = nullptr;		m_fSpecialTimer = 15.0f;	}	//if not rushing do basic path finding to the player	if(GetTarget() != nullptr)	{		float tar_pos_x = GetTarget()->GetPosX();		float tar_pos_y = GetTarget()->GetPosY();		if(tar_pos_x > GetPosX())		{			//set Grunt's animation's facing to the right			SetFlipped(true);		}		else		{			SetFlipped(false);		}		if(m_fMoveAway <= 0)		{			//	tar_pos_x += (m_bFlipped) ? -236 : 236;			//Simple Pathing twards the player			if(tar_pos_y != GetPosY())//Above the Player			{				float min_Distance = (float)(GetTarget()->GetWidth()/2 + GetWidth()/2);				if(GetPosX() + min_Distance > tar_pos_x && GetPosX() - min_Distance < tar_pos_x)				{					if( tar_pos_x < GetPosX())						SetVelX(speed * fElapsedTime);					else						SetVelX(-speed * fElapsedTime);				}				else				{					if( tar_pos_y < GetPosY())						SetVelY(-speed * fElapsedTime);					else						SetVelY(speed * fElapsedTime);					if( tar_pos_x < GetPosX())						SetVelX(-speed * fElapsedTime);					else						SetVelX(speed * fElapsedTime);					if( tar_pos_x > (GetPosX() - 64) && tar_pos_x < (GetPosX() + 64) )					{						if( tar_pos_y > (GetPosY() - 32) && tar_pos_y < (GetPosY() + 32) && m_bPunching == false)						{							GetAnimInfo()->SetAnimationName("Boss1_Attack_Animation");							m_bPunching = true;							//dynamic_cast<CPlayer*>(GetTarget())->SetState(CEntityState::KNOCKED_DOWN);						}					}				}			}			else			{				SetVelY(0);				if( tar_pos_x < GetPosX())//.........这里部分代码省略.........
开发者ID:kendellm,项目名称:Trials-of-Mastery,代码行数:101,


示例8: Hide

void CTargetMenu::Update( POINT ptMouse ){	if( !IsVision()) return;	CTDialog::Update( ptMouse );	if( m_iTargetAvatarID )	{		CObjCHAR *pObj = (CObjCHAR*)g_pObjMGR->Get_CharOBJ( m_iTargetAvatarID, true );		/// 
C++ GetWindow函数代码示例
C++ GetWidget函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。