コード例 #1
0
void Texture::Apply(u8 &tlutName, u8 map_id, u8 wrap_s, u8 wrap_t) const
{
	if( !loaded )
	{
		gprintf( "Texture::Apply(): not loaded yet\n" );
		return;
	}

	if(tlutName >= 20 || map_id >= 8)
	{
		gprintf( "Texture::Apply(): bad parameters\n" );
		return;
	}

    // create a temporary texture object to not modify the original with the wrap_s and wrap_t parameters
	GXTexObj tempTexObj;
	for(int i = 0; i < 8; ++i)
		tempTexObj.val[i] = texobj.val[i];

	// assume that if there is a palette header, then this format is a CIx one
	if(palette)
	{
		// seek to/read palette data
		u8 *tlut_data = (u8 *) (((u8 *) header) + palette->offset);

		// load tlut
		GXTlutObj tlutobj;
		GX_InitTlutObj(&tlutobj, tlut_data, palette->format, palette->num_items );
		GX_LoadTlut(&tlutobj, tlutName);
		GX_InitTexObjTlut(&tempTexObj, tlutName);
		tlutName++;
	}

    GX_InitTexObjWrapMode(&tempTexObj, wrap_s, wrap_t);
	GX_LoadTexObj(&tempTexObj, map_id);
}
コード例 #2
0
ファイル: Image.cpp プロジェクト: DusterTheThief2/mupen64gc
void Image::activateImage(u8 mapid)
{
	if (tlut_ptr) GX_LoadTlut(&tlut_obj, tlut_name);	
	GX_LoadTexObj(&obj, mapid);
}