Jakis czas temu, programista Jan Horn przelozyl pierwsza czesc tutoriala o Quake3 BSP na Delphi. Niestety bez lightmapingu..
Zatem kieruje pytanie do was, czy ktos moze ma, sam przetlumaczyl lub znalazl w sieci kompletny kod ladujacy QuakeBSP w Delphi(wraz z Lightmapami)?
Sam podjąlem probe przelozenia tego kodu z C++, lecz utknąlem w punkcie, ktorego na tym etapie programowania nie jestem w stanie przeskoczyc:
fragmet kodu odpowiadajacego za lightmapy:
type TBSPLightmap = Record
imageBits : Array[0..127, 0..127, 0..2] of Byte; // The RGB data in a 128x128 image
end;
var
Textures : Array of glUint;
m_Lightmaps : Array of glUint;
BSPLightmap : Array of TBSPLightmap;
// Allocate memory to read in the lightmap data. Like the texture
// data, we just need to create a local array to be destroyed real soon.
//kod w C++:
// m_numOfLightmaps = lumps[kLightmaps].length / sizeof(tBSPLightmap);
//tBSPLightmap *pLightmaps = new tBSPLightmap [m_numOfLightmaps ];
numOfLightmaps := Round( lumps[kLightmaps].length / sizeof(tBSPLightmap) );
SetLength(BSPLightmap , numOfLightmaps);
Seek(f, lumps[kLightmaps].offset);
for i := 0 to numOfLightmaps-1 do
begin
// Read in the RGB data for each lightmap
BlockRead(F, BSPLightmap[i],sizeof(tBSPLightmap));
// Create a texture map for each lightmap that is read in. The lightmaps
// are always 128 by 128.
//kod w C++
//CreateLightmapTexture(m_lightmaps[i],(unsigned char *)pLightmaps[i].imageBits, 128, 128);
I tu pojawia się problem... za nic nie wiem jak powinien wyglądać ten wiersz:
CreateLightmapTexture(m_lightmaps[i],BSPLightmap[i].imageBits, 128, 128); //tak jak teraz nie działa
Zatem proszę o pomoc!