void	CL_PrecacheResources()
{
	static int alreadyPrecached = 0; // UTTAR: Much faster map switching! :)
	
	if (!cl.gotObjectTypes)
		core.Game_Error("Started precaching resources without object type data!\n");

	if(!alreadyPrecached)
	{
		CL_LoadInterfaceResources();
		res.minimap = corec.Res_LoadShaderEx(corec.Cvar_GetString("world_overhead"), SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.mainCursor.shader = corec.Res_LoadShaderEx("/textures/cursors/arrow.s2g", SHD_NO_MIPMAPS | SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.errorCursor.shader = corec.Res_LoadShaderEx("/textures/cursors/red_x.s2g", SHD_NO_MIPMAPS | SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.unknownCursor.shader = corec.Res_LoadShaderEx("/textures/cursors/unknown.s2g", SHD_NO_MIPMAPS | SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.crosshairCursor.shader = corec.Res_LoadShaderEx("/textures/cursors/crosshair.s2g", SHD_NO_MIPMAPS | SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.crosshairCursor.hotspotx = 0.5;		//put the hotspot in the middle of the crosshair
		res.crosshairCursor.hotspoty = 0.5;		//put the hotspot in the middle of the crosshair
		Rend_SetMouseCursor(&res.mainCursor);
		res.blackShader = corec.Res_LoadShaderEx("/textures/black.s2g", SHD_NO_MIPMAPS | SHD_FULL_QUALITY | SHD_NO_SHADER);
		//res.shadowShader = corec.Res_LoadShaderEx("/textures/effects/shadow/shadow.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		//res.longshadowShader = corec.Res_LoadShaderEx("/textures/effects/shadow/longshadow.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		//res.spotshadowShader = corec.Res_LoadShaderEx("/textures/effects/shadow/spotshadow.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.lightbeamShader = corec.Res_LoadShaderEx("/textures/effects/1_nl_beam.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.lightbeamRedShader = corec.Res_LoadShaderEx("/textures/effects/1_nl_beamred.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.selectionIndicatorSmallShader = corec.Res_LoadShaderEx(Tex("selection_indicator_small"), SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.selectionIndicatorLargeShader = corec.Res_LoadShaderEx(Tex("selection_indicator_large"), SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.whiteShader = corec.GetWhiteShader();
		res.friendlyIcon =	corec.Res_LoadShaderEx("/textures/icons/nl_friendly.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.reviveIcon =	corec.Res_LoadShaderEx("/textures/icons/nl_revive.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.voiceIcon =		corec.Res_LoadShaderEx("/textures/icons/nl_voice.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.waypointMoveIcon = corec.Res_LoadShaderEx("/textures/icons/waypoint_default.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.waypointAttackIcon = corec.Res_LoadShaderEx("/textures/icons/waypoint_attack.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		// UTTAR: New stuff
		res.pathLineShader = corec.Res_LoadShaderEx("/textures/indicators/t_pathline.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.radEffectLineShader = corec.Res_LoadShaderEx("/textures/indicators/radeffectline.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.radiuseffectmarker = corec.Res_LoadShaderEx("/textures/indicators/radiuseffectmarker.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.constructionShader = corec.Res_LoadShaderEx(cl_constructionShader.string, SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.tryConstructionShader = corec.Res_LoadShaderEx(cl_tryConstructionShader.string, SHD_FULL_QUALITY | SHD_NO_SHADER);
		res.waypoint_ground = corec.Res_LoadShaderEx("/textures/icons/1_nl_waypoint_ground.s2g", SHD_FULL_QUALITY | SHD_NO_SHADER);

		// Case: Newer stuff
		res.constructionArrowShader = corec.Res_LoadShaderEx(cl_constructionArrowShader.string, SHD_FULL_QUALITY | SHD_NO_SHADER);
		// UTTAR: Don't do this again, please.
		alreadyPrecached = 1;
		PrecacheThread();
	}
}
Beispiel #2
0
Texture& TextureRepo::operator()( int32_t Id )
{
    ElementMap_t::iterator i = mElements.find( Id );
    if( i != mElements.end() )
    {
        return *( i->second );
    }
    if( std::find( mUnavailElements.begin(), mUnavailElements.end(), Id ) != mUnavailElements.end() )
    {
        return const_cast<Texture&>( mDefaultElement );
    }
    do
    {
        std::string Path;
        if( !IdStorage::Get().GetName( Id, Path ) )
        {
            break;
        }
        AutoFile TexFile = mFilesys.Open( Path );
        if( !TexFile.get() )
        {
            break;
        }
        std::auto_ptr<TextureBase> TexBase;
        if( boost::iequals( boost::filesystem::path( Path ).extension().string(), ".png" ) )
        {
            TexBase.reset( new PngTexture( *TexFile ) );
        }
        else if( boost::iequals( boost::filesystem::path( Path ).extension().string(), ".tga" ) )
        {
            TexBase.reset( new TgaTexture( *TexFile ) );
        }
        if( !TexBase.get() )
        {
            break;
        }
        std::auto_ptr<Texture> Tex( new Texture( TexBase->GetWidth(), TexBase->GetHeight(), TexBase->GetChannels(), TexBase->GetData() ) );
        if( Tex->TexId() == 0 )
        {
            break;
        }
        mElements.insert( Id, Tex.get() );
        return *Tex.release();
    }
    while( false );
    mUnavailElements.push_back( Id );
    return const_cast<Texture&>( mDefaultElement );
}
void TerrainGenerator::SetTex(float u, float v)		// Sets The Color Value For A Particular Index, Depending On The Height Index
{
	fTexCoords3d Tex(u,v);

	_vboTex.push_back(Tex);
}
void liveCoding::setupShaderInputs()
{
	textures_.push_back( Tex( "iSplashScreen", "textures/splashScreen.png" ) );
	textures_.push_back( Tex( "iChecker", "textures/checker.png" ) );
  textures_.push_back( Tex( "iNoise", "textures/noise.png" ) );
	textures_.push_back( Tex( "iTex1", "textures/tex1.png" ) );
	textures_.push_back( Tex( "iTex2", "textures/tex2.png" ) );
	textures_.push_back( Tex( "iTex3", "textures/tex3.png" ) );
	textures_.push_back( Tex( "iTex4", "textures/tex4.png" ) );
	textures_.push_back( Tex( "iTex5", "textures/tex5.png" ) );
	textures_.push_back( Tex( "iTex6", "textures/tex6.png" ) );
	textures_.push_back( Tex( "iTex7", "textures/tex7.png" ) );
	textures_.push_back( Tex( "iTex8", "textures/tex8.png" ) );
}