void C_Prop_Hallucination::Spawn( void ) { if( !sm_OcclusionProxyMaterial.IsValid() ) { sm_OcclusionProxyMaterial.Init( "engine/occlusionproxy", TEXTURE_GROUP_CLIENT_EFFECTS ); } BaseClass::Spawn(); }
int CBulletManager::CBullet::DrawModel( int flags ) { if (m_flCurrAlpha < 0) return 0; if (flags & STUDIO_SHADOWDEPTHTEXTURE) return 0; #ifdef __linux__ return 0; #endif if (!g_hBulletStreak.IsValid()) g_hBulletStreak.Init( "effects/tracer1.vmt", TEXTURE_GROUP_OTHER ); float flAlpha = 150.5f/255.0f * m_flCurrAlpha; Vector vecRight = Vector(0, 0, 1).Cross(m_vecDirection).Normalized(); Vector vecCross1 = (Vector(0, 0, 1) + vecRight).Normalized(); Vector vecCross2 = (Vector(0, 0, 1) - vecRight).Normalized(); CMeshBuilder meshBuilder; CMatRenderContextPtr pRenderContext( materials ); pRenderContext->Bind( g_hBulletStreak ); IMesh* pMesh = pRenderContext->GetDynamicMesh(); meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 ); DrawCross(meshBuilder, GetRenderOrigin(), vecCross1, m_vecDirection, flAlpha); DrawCross(meshBuilder, GetRenderOrigin(), vecCross2, m_vecDirection, flAlpha); meshBuilder.End(false, true); return 1; }
int CBaseGrenadeProjectile::DrawModel( int flags ) { // During the first half-second of our life, don't draw ourselves if he's // still playing his throw animation. // (better yet, we could draw ourselves in his hand). if ( GetThrower() != C_BasePlayer::GetLocalPlayer() ) { if ( gpGlobals->curtime - m_flSpawnTime < 0.5 ) { //Tony; FIXME! // C_SDKPlayer *pPlayer = dynamic_cast<C_SDKPlayer*>( GetThrower() ); // if ( pPlayer && pPlayer->m_PlayerAnimState->IsThrowingGrenade() ) // { // return 0; // } } } if (!g_hGrenadeArrow.IsValid()) g_hGrenadeArrow.Init( "particle/grenadearrow.vmt", TEXTURE_GROUP_OTHER ); int iReturn = BaseClass::DrawModel(flags); C_SDKPlayer* pLocalPlayer = C_SDKPlayer::GetLocalSDKPlayer(); if (!pLocalPlayer) return iReturn; if (pLocalPlayer == GetThrower()) return iReturn; float flAppearDistance = 500; float flAppearDistanceSqr = flAppearDistance*flAppearDistance; if ((pLocalPlayer->GetAbsOrigin() - GetAbsOrigin()).LengthSqr() < flAppearDistanceSqr) m_flArrowGoalSize = 20; else m_flArrowGoalSize = 0; float flTime = C_SDKPlayer::GetLocalSDKPlayer()->GetCurrentTime() + m_flArrowSpinOffset; float flFrameTime = gpGlobals->frametime * C_SDKPlayer::GetLocalSDKPlayer()->GetSlowMoMultiplier(); m_flArrowCurSize = Approach(m_flArrowGoalSize, m_flArrowCurSize, flFrameTime*100); if (m_flArrowCurSize == 0) return iReturn; Vector vecViewForward, vecViewRight, vecViewUp; pLocalPlayer->EyeVectors(&vecViewForward, &vecViewRight, &vecViewUp); float flSin = sin(flTime*4); float flCos = cos(flTime*4); Vector vecOrigin = GetAbsOrigin(); Vector vecRight = vecViewRight * flSin + vecViewUp * flCos; Vector vecUp = vecViewRight * -flCos + vecViewUp * flSin; float flSize = m_flArrowCurSize; CMeshBuilder meshBuilder; CMatRenderContextPtr pRenderContext( materials ); IMesh* pMesh = pRenderContext->GetDynamicMesh(); pRenderContext->Bind( g_hGrenadeArrow ); meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 ); meshBuilder.Color4f( 1, 1, 1, 1 ); meshBuilder.TexCoord2f( 0,0, 0 ); meshBuilder.Position3fv( (vecOrigin + (vecRight * -flSize) + (vecUp * flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color4f( 1, 1, 1, 1 ); meshBuilder.TexCoord2f( 0,1, 0 ); meshBuilder.Position3fv( (vecOrigin + (vecRight * flSize) + (vecUp * flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color4f( 1, 1, 1, 1 ); meshBuilder.TexCoord2f( 0,1, 1 ); meshBuilder.Position3fv( (vecOrigin + (vecRight * flSize) + (vecUp * -flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.Color4f( 1, 1, 1, 1 ); meshBuilder.TexCoord2f( 0,0, 1 ); meshBuilder.Position3fv( (vecOrigin + (vecRight * -flSize) + (vecUp * -flSize)).Base() ); meshBuilder.AdvanceVertex(); meshBuilder.End(false, true); return iReturn; }