void main(void)
	{
		vec4 rgb = texture2D(texture, fragmentTextureCoordinate.xy);
		vec3 hsl = RgbToHsl(rgb.rgb);

		rgb *= smoothstep(threshold*sharpness, threshold*(2-sharpness), hsl.z);

		gl_FragColor = rgb;
	}
Exemplo n.º 2
0
void CMenus::RenderIdents(CUIRect MainView)
{
	const int NumIdentities = m_pClient->m_pIdentity->NumIdents();
	CUIRect Button, Label, Temp;
	static float s_Scrollbar = 0;
	static float s_ScrollValue = 0;

	RenderTools()->DrawUIRect(&MainView, vec4(0.65f, 0.68f, 0.9f, 0.64f), CUI::CORNER_T, 10.0f);

	MainView.HSplitTop(8.0f, &Button, &Temp);
	Button.VSplitMid(&Button, &Label);

	// scrollbar
	Temp.HSplitTop(16.0f, &Button, &Temp);
	Button.VMargin(4.0f, &Button);
	s_ScrollValue = DoScrollbarH(&s_Scrollbar, &Button, s_ScrollValue);

	Temp.HSplitTop(68.0f, &Button, &Temp);
	UI()->ClipEnable(&Button);
	Button.HMargin(5.0f, &Button);
	Button.VSplitLeft(7.5f, 0, &Button);

	int Offset = 2*30.0f + 80 * (NumIdentities - 4);
	if(Offset > 0)
		Button.x -= Offset * s_ScrollValue;

	for(int i = 0; i < NumIdentities; i++)
	{
		CIdentity::CIdentEntry *pIdent = m_pClient->m_pIdentity->GetIdent(i);
		if(pIdent == NULL)
			continue;

		const CSkins::CSkin *pSkin = NULL;
		CTeeRenderInfo SkinInfo;

		pSkin = m_pClient->m_pSkins->Get(m_pClient->m_pSkins->Find(pIdent->m_aSkin));

		if(pIdent->m_UseCustomColor)
		{
			SkinInfo.m_Texture = pSkin->m_ColorTexture;
			SkinInfo.m_ColorBody = m_pClient->m_pSkins->GetColorV4(pIdent->m_ColorBody);
			SkinInfo.m_ColorFeet = m_pClient->m_pSkins->GetColorV4(pIdent->m_ColorFeet);
		}
		else
		{
			SkinInfo.m_Texture = pSkin->m_OrgTexture;
			SkinInfo.m_ColorBody = vec4(1.0f, 1.0f, 1.0f, 1.0f);
			SkinInfo.m_ColorFeet = vec4(1.0f, 1.0f, 1.0f, 1.0f);
		}

		Button.VSplitLeft(80.0f, &Label, &Button);
		static int s_Button[512] = {0};
		if(DoButton_Menu(&s_Button[i], "", 0, &Label, 0, CUI::CORNER_ALL, pIdent->m_UseCustomColor ? mix(SkinInfo.m_ColorBody, SkinInfo.m_ColorFeet, 0.4f)*0.7f :
				vec4(pSkin->m_BloodColor.r, pSkin->m_BloodColor.g, pSkin->m_BloodColor.b, 0.7f)))
		{
			CIdentity::CIdentEntry *pIdent = m_pClient->m_pIdentity->GetIdent(i);
			str_format(g_Config.m_PlayerName, sizeof(g_Config.m_PlayerName), pIdent->m_aName);
			str_format(g_Config.m_PlayerClan, sizeof(g_Config.m_PlayerClan), pIdent->m_aClan);
			str_format(g_Config.m_ClPlayerSkin, sizeof(g_Config.m_ClPlayerSkin), pIdent->m_aSkin);
			g_Config.m_ClPlayerUseCustomColor = pIdent->m_UseCustomColor;
			g_Config.m_ClPlayerColorBody = pIdent->m_ColorBody;
			g_Config.m_ClPlayerColorFeet = pIdent->m_ColorFeet;
			m_pClient->SendInfo(false);
		}

		SkinInfo.m_Size = 50.0f*UI()->Scale();
		RenderTools()->RenderTee(CAnimState::GetIdle(), &SkinInfo, 0, vec2(1, 0), vec2(Label.x + Label.w * 0.5f, Label.y + Label.h * 0.5f + 8.0f));

		Label.HSplitBottom(15.0f, 0, &Label);
		Label.y = Button.y;
		// some h4XoRinG right here to get awesome R41NB0W!!
		static float s_Hue = 1000.0f;
		if(s_Hue > 1.0f) s_Hue = RgbToHsl(vec3(1.0f, 0.0f, 0.0f)).h;
		s_Hue += 0.0007f;
		vec3 rgb = HslToRgb(vec3(s_Hue, 1.0f, 0.5f));
		RenderTools()->DrawUIRect(&Label, GameClient()->m_pIdentity->UsingIdent(i) ? vec4(rgb.r, rgb.g, rgb.b, 0.71f) :
				vec4(pSkin->m_BloodColor.r * 0.3f, pSkin->m_BloodColor.g * 0.3f, pSkin->m_BloodColor.b * 0.3f, 0.95f), CUI::CORNER_T, 4.0f);
		UI()->DoLabelScaled(&Label, pIdent->m_aName, 10.0f, 0);
		Button.VSplitLeft(15.0f, 0, &Button);
	}

	UI()->ClipDisable();
}