コード例 #1
0
ファイル: decals.cpp プロジェクト: Axitonium/SourceEngine2007
void Draw_DecalSetName( int decal, char *name )
{
	while ( decal >= g_DecalLookup.Count() )
	{
		MEM_ALLOC_CREDIT();
		int idx = g_DecalLookup.AddToTail();
		g_DecalLookup[idx] = g_DecalDictionary.InvalidIndex();
	}

	FileNameHandle_t fnHandle = g_pFileSystem->FindOrAddFileName( name );
	int lookup = g_DecalDictionary.Find( fnHandle );
	if ( lookup == g_DecalDictionary.InvalidIndex() )
	{
		DecalEntry entry;
#ifdef _DEBUG
		int len = strlen(name) + 1;
		entry.m_pDebugName = new char[len];
		memcpy( entry.m_pDebugName, name, len );
#endif
		entry.material = GL_LoadMaterial( name, TEXTURE_GROUP_DECAL );
		entry.index = decal;

		lookup = g_DecalDictionary.Insert( fnHandle, entry );
	}
	else
	{
		g_DecalDictionary[lookup].index = decal;
	}

	g_DecalLookup[decal] = lookup;
}
コード例 #2
0
void Draw_DecalSetName( int decal, char *name )
{
	while ( decal >= g_DecalLookup.Count() )
	{
		int idx = g_DecalLookup.AddToTail();
		g_DecalLookup[ idx ] = 0;
	}

	int lookup = g_DecalDictionary.Find( name );
	if ( lookup == g_DecalDictionary.InvalidIndex() )
	{
		DecalEntry entry;
		entry.material = GL_LoadMaterial( name );
		entry.index = decal;

		lookup = g_DecalDictionary.Insert( name, entry );
	}

	g_DecalLookup[ decal ] = lookup;
}