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


C++ CCamera::GetBillboardNoneX方法代码示例

本文整理汇总了C++中CCamera::GetBillboardNoneX方法的典型用法代码示例。如果您正苦于以下问题:C++ CCamera::GetBillboardNoneX方法的具体用法?C++ CCamera::GetBillboardNoneX怎么用?C++ CCamera::GetBillboardNoneX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCamera的用法示例。


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

示例1: RenderEx

const EFFECT_RESULT CFlareSprite::RenderEx( const CMatrix& matWorld, RenderObjStyle* pRORS )
{
	const CFlareSpriteProp* pProp = (CFlareSpriteProp*)m_pEffectUnitProp;

	EFFECT_RESULT Result( NULL, true, false );

	if( !IsInRenderTime() )
		return Result;

	float fPercent = GetUnitPercent();
	CCamera* pCamera = CMainWindowTarget::GetInst()->GetCamera();
	//CGraphic::GetInst()->GetCamera( &pCamera );

	float DeltaTime = m_DeltaTime / 1000.0f;
	CVector3f OrgOffset( 0, 0, 0 );
	ITexture* pCurText = NULL;
	uint32 Color = 0xff000000;
	if( pProp->m_vecOffset.size() )
		OrgOffset = GetMapValue( pProp->m_vecOffset, fPercent );
	if( pProp->m_Texture.size() )
		pCurText = GetMapState( pProp->m_Texture, fPercent*pProp->m_nTextureCircle - (int)( fPercent*pProp->m_nTextureCircle ) );
	if( pProp->m_Color.size() )
		Color = GetMapValue( pProp->m_Color, fPercent )&0x00ffffff;

	VerNCT* pVB;
	RenderState* pRS;
	CMatrix* pMatrix = CGraphic::GetInst()->GetRenderStack( RS_DEFAULT, pCurText, NULL, PT_TRIANGLESTRIP, 4, 2, 
		VerNCT::Format, sizeof(VerNCT), (void**)&pVB, NULL, (void**)&pRS );

	CVector3f InvNormal( 0, 0, 1 );
	if( pProp->m_eFaceType == SPRF_CAMERA || ( pProp->m_vecNormal.x == 0 && pProp->m_vecNormal.y == 0 && pProp->m_vecNormal.z == 0 ) )
		pCamera->GetBillboardAll( m_matWorld );
	else
	{
		if( pProp->m_AngularVelocity > 0.00001f )
		{
			m_CurAngle += pProp->m_AngularVelocity*DeltaTime;
			if( m_CurAngle > 6.283f )
				m_CurAngle = 0.0;
			if( m_CurAngle < 0.0f )
				m_CurAngle = 6.283f;
			CMatrix Rotate;
			pProp->m_pEffectClassDesc->SetRotate( Rotate, pProp->m_vecRotate/pProp->m_AngularVelocity, m_CurAngle );
			if( pProp->m_eFaceType == SPRF_CAMERANONEX )
			{
				pCamera->GetBillboardNoneX( m_matWorld );
				m_matWorld = Rotate*m_matWorld;
			}
			else
				m_matWorld = pProp->m_matNormal*Rotate;
		}
		else
		{
			if( pProp->m_eFaceType == SPRF_CAMERANONEX )
				pCamera->GetBillboardNoneX( m_matWorld );
			else
				m_matWorld = pProp->m_matNormal;
		}

		if( pProp->m_eFaceType == SPRF_NORMAL )
			InvNormal    = -pProp->m_vecNormal;
	}

	CVector3f Offset,CameraDir;
	CameraDir = pCamera->getDIRECTION();//pCamera->GetCameraDir( CameraDir );
	OrgOffset.FastMultiply( m_matWorld );
	m_matWorld._41 = Offset.x;
	m_matWorld._42 = Offset.y;
	m_matWorld._43 = Offset.z;

	*pMatrix = m_matWorld;

	float Scale = pProp->m_fMinSize;
	uint32 Alpha = pProp->m_byMinAlpha;
	float Dot = InvNormal.Dot( CameraDir );
	if( Dot > pProp->m_MaxCosAngle )
	{
		Scale += abs( pProp->m_fMaxSize - pProp->m_fMinSize )*( Dot - pProp->m_MaxCosAngle )/( 1 - pProp->m_MaxCosAngle );
		Alpha += (uint32)( abs( (int)pProp->m_byMaxAlpha - (int)pProp->m_byMinAlpha )*( Dot - pProp->m_MaxCosAngle )/( 1 - pProp->m_MaxCosAngle ) );
		Alpha =  ( (uint32)(BYTE)Alpha ) << 24;
	}
	Color |= Alpha;


	CVector3f vecS( m_matWorld._11 + m_matWorld._12 + m_matWorld._13, 
					m_matWorld._21 + m_matWorld._22 + m_matWorld._23,
					m_matWorld._31 + m_matWorld._32 + m_matWorld._33 );
	Scale = vecS.Mag()*Scale;

	pRS->m_Cull			= CULLT_NONE;				//D3DCULL_NONE;
	pRS->m_AlpOP_S0		= TOP_MODULATE;				//D3DTOP_MODULATE;
	pRS->m_LightEnable	= pProp->m_bLightEnable;
	pRS->m_ZTestEnable	= pProp->m_eZTest != Z_NONE;
	pRS->m_ZWrite			= pProp->m_eZTest != Z_TESTONLY;

	if( pProp->m_eBlendModel == SPRB_NONE )
		pRS->m_AlphaBlendEnable = FALSE;
	else
	{
		pRS->m_AlphaBlendEnable = TRUE;
//.........这里部分代码省略.........
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:101,代码来源:CFlareSprite.cpp


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