Esempio n. 1
0
int CGraphics_Threaded::UnloadTexture(CTextureHandle Index)
{
	if(Index.Id() == m_InvalidTexture.Id())
		return 0;

	if(!Index.IsValid())
		return 0;

	CCommandBuffer::SCommand_Texture_Destroy Cmd;
	Cmd.m_Slot = Index.Id();
	m_pCommandBuffer->AddCommand(Cmd);

	m_aTextureIndices[Index.Id()] = m_FirstFreeTexture;
	m_FirstFreeTexture = Index.Id();
	return 0;
}
Esempio n. 2
0
int CGraphics_Threaded::LoadTextureRawSub(CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData)
{
	CCommandBuffer::SCommand_Texture_Update Cmd;
	Cmd.m_Slot = TextureID.Id();
	Cmd.m_X = x;
	Cmd.m_Y = y;
	Cmd.m_Width = Width;
	Cmd.m_Height = Height;
	Cmd.m_Format = ImageFormatToTexFormat(Format);

	// calculate memory usage
	int MemSize = Width*Height*ImageFormatToPixelSize(Format);

	// copy texture data
	void *pTmpData = mem_alloc(MemSize, sizeof(void*));
	mem_copy(pTmpData, pData, MemSize);
	Cmd.m_pData = pTmpData;

	//
	m_pCommandBuffer->AddCommand(Cmd);
	return 0;
}
Esempio n. 3
0
void CGraphics_Threaded::TextureSet(CTextureHandle TextureID)
{
	dbg_assert(m_Drawing == 0, "called Graphics()->TextureSet within begin");
	m_State.m_Texture = TextureID.Id();
	m_State.m_Dimension = 2;
}