void C_CFPlayer::GetShadowRenderBounds( Vector &mins, Vector &maxs, ShadowType_t shadowType ) { GetRenderBounds( mins, maxs ); // We do this because the normal bbox calculations don't take pose params into account, and // the rotation of the guy's upper torso can place his gun a ways out of his bbox, and // the shadow will get cut off as he rotates. // // Thus, we give it some padding here. mins -= Vector( 4, 4, 0 ); maxs += Vector( 4, 4, 0 ); }
//upkeep void SliderWidget::Update(double deltaSeconds) { ProgressBarWidget::Update(deltaSeconds); AABB2 mySliderBounds = GetRenderBounds(); Vector2 mySliderLength = mySliderBounds.CalcLengthOfSides(); m_sliderButton->SetDimensions(Vector2(mySliderLength.x * 0.1f, mySliderLength.y * 1.25f)); //set percent num WidgetStateProperties& currentStateProperties = GetCurrentStateProperties(); float myPercent; currentStateProperties.GetProperty("percent", myPercent); std::string percentString = FloatToString(myPercent * 100, "%.0f") + "%"; m_sliderButton->SetText(percentString); m_sliderButton->Update(deltaSeconds); }
void C_AI_BaseNPC::ClientThink( void ) { BaseClass::ClientThink(); #ifdef HL2_DLL C_BaseHLPlayer *pPlayer = dynamic_cast<C_BaseHLPlayer*>( C_BasePlayer::GetLocalPlayer() ); if ( ShouldModifyPlayerSpeed() == true ) { if ( pPlayer ) { float flDist = (GetAbsOrigin() - pPlayer->GetAbsOrigin()).LengthSqr(); if ( flDist <= GetSpeedModifyRadius() ) { if ( pPlayer->m_hClosestNPC ) { if ( pPlayer->m_hClosestNPC != this ) { float flDistOther = (pPlayer->m_hClosestNPC->GetAbsOrigin() - pPlayer->GetAbsOrigin()).Length(); //If I'm closer than the other NPC then replace it with myself. if ( flDist < flDistOther ) { pPlayer->m_hClosestNPC = this; pPlayer->m_flSpeedModTime = gpGlobals->curtime + cl_npc_speedmod_intime.GetFloat(); } } } else { pPlayer->m_hClosestNPC = this; pPlayer->m_flSpeedModTime = gpGlobals->curtime + cl_npc_speedmod_intime.GetFloat(); } } } } #endif // HL2_DLL #ifdef HL2_EPISODIC C_BaseHLPlayer *pPlayer = dynamic_cast<C_BaseHLPlayer*>( C_BasePlayer::GetLocalPlayer() ); if ( pPlayer && m_flTimePingEffect > gpGlobals->curtime ) { float fPingEffectTime = m_flTimePingEffect - gpGlobals->curtime; if ( fPingEffectTime > 0.0f ) { Vector vRight, vUp; Vector vMins, vMaxs; float fFade; if( fPingEffectTime <= 1.0f ) { fFade = 1.0f - (1.0f - fPingEffectTime); } else { fFade = 1.0f; } GetRenderBounds( vMins, vMaxs ); AngleVectors (pPlayer->GetAbsAngles(), NULL, &vRight, &vUp ); Vector p1 = GetAbsOrigin() + vRight * vMins.x + vUp * vMins.z; Vector p2 = GetAbsOrigin() + vRight * vMaxs.x + vUp * vMins.z; Vector p3 = GetAbsOrigin() + vUp * vMaxs.z; int r = 0 * fFade; int g = 255 * fFade; int b = 0 * fFade; debugoverlay->AddLineOverlay( p1, p2, r, g, b, true, 0.05f ); debugoverlay->AddLineOverlay( p2, p3, r, g, b, true, 0.05f ); debugoverlay->AddLineOverlay( p3, p1, r, g, b, true, 0.05f ); } } #endif }
//----------------------------------------------------------------------------- // Purpose: Draws the object //----------------------------------------------------------------------------- int C_NPC_Barnacle::InternalDrawModel( int flags ) { if ( !GetModel() ) return 0; // Make sure hdr is valid for drawing if ( !GetModelPtr() ) return 0; // UNDONE: With a bit of work on the model->world transform, we can probably // move the frustum culling into the client DLL entirely. Then TestVisibility() // can just return true/false and only be called when frustumcull is set. if ( flags & STUDIO_FRUSTUMCULL ) { switch ( TestVisibility() ) { // not visible, don't draw case VIS_NOT_VISIBLE: return 0; // definitely visible, disable engine check case VIS_IS_VISIBLE: flags &= ~STUDIO_FRUSTUMCULL; break; default: case VIS_USE_ENGINE: break; } } Vector vecMins, vecMaxs; GetRenderBounds( vecMins, vecMaxs ); int drawn = modelrender->DrawModel( flags, this, GetModelInstance(), index, GetModel(), GetAbsOrigin(), GetAbsAngles(), GetSequence(), m_nSkin, m_nBody, m_nHitboxSet, &GetAbsMins(), &GetAbsMaxs() ); if ( vcollide_wireframe.GetBool() ) { if ( IsRagdoll() ) { m_pRagdoll->DrawWireframe(); } else { vcollide_t *pCollide = modelinfo->GetVCollide( GetModelIndex() ); if ( pCollide && pCollide->solidCount == 1 ) { static color32 debugColor = {0,255,255,0}; matrix3x4_t matrix; AngleMatrix( GetAbsAngles(), GetAbsOrigin(), matrix ); engine->DebugDrawPhysCollide( pCollide->solids[0], NULL, matrix, debugColor ); } } } return drawn; }
void SetRenderBounds(){ m_renderBounds = GetRenderBounds(); }
void RenderOver( Gwen::Skin::Base* skin ) { skin->GetRender()->SetDrawColor( Color( 90, 90, 90, 255 ) ); skin->GetRender()->DrawLinedRect( GetRenderBounds() ); }
void Render( Gwen::Skin::Base* skin ) { skin->GetRender()->SetDrawColor( Color( 255, 255, 255, 255 ) ); skin->GetRender()->DrawFilledRect( GetRenderBounds() ); }