// Take engine supplied lightmap raw-RGB data and put it into a texture handle.
void THandle_DownloadLightmap(DRV_LInfo *LInfo)
{
	GLubyte *tempBits;

	THandle_Lock(LInfo->THandle, 0, (void**)&tempBits);

	memcpy(tempBits, LInfo->RGBLight[0], LInfo->THandle->Width * LInfo->THandle->Height * 3);

	THandle_UnLock(LInfo->THandle, 0);
}
Esempio n. 2
0
//=====================================================================================
//	FillLMapSurface
//=====================================================================================
static void FillLMapSurface(DRV_LInfo *LInfo, int32 LNum)
{
	U16					*pTempBits;
	int32				w, h, Width, Height, Size;
	U8					*pBitPtr;
	RGB_LUT				*Lut;
	geRDriver_THandle	*THandle;
	int32				Extra;

	THandle = LInfo->THandle;

	pBitPtr = (U8*)LInfo->RGBLight[LNum];

	Width = LInfo->Width;
	Height = LInfo->Height;
	Size = 1<<THandle->Log;

	Lut = &AppInfo.Lut1;

	THandle_Lock(THandle, 0, (void**)&pTempBits);

	Extra = Size - Width;
	U8	R, G, B;
	U16	Color;

	for (h=0; h< Height; h++)
	{
		for (w=0; w< Width; w++)
		{
			R = *pBitPtr++;
			G = *pBitPtr++;
			B =  *pBitPtr++;
			
			Color = (U16)(Lut->R[R] | Lut->G[G] | Lut->B[B]);

			*pTempBits++ = Color;
		}
		pTempBits += Extra;
	}

	THandle_UnLock(THandle, 0);
}