31 #define AUTO_RELOAD_SHADERS
37 #define DEBUG_SEPERATOR_TEXTURES
53 ZeroMem(Surfaces,
sizeof(Surfaces));
54 hMaterialTexture = matMapTexture = 0;
75 this->TimerStart = std::chrono::steady_clock::now();
78 if (!InitLandscapeTexture())
80 LogFatal(
"[!] Could not initialize landscape texture!");
85 if (!InitMaterialTexture(
pTexs))
87 LogFatal(
"[!] Could not initialize landscape textures for rendering!");
92 if (!LoadScaler(pGraphics))
94 LogFatal(
"[!] Could not load scaler!");
99 if (!LoadShaders(pGraphics))
101 LogFatal(
"[!] Could not initialize landscape shader!");
107 LogFatal(
"[!] Could not initialize landscape VBO!");
121 for (
auto & Surface : Surfaces)
128 if (!InitLandscapeTexture())
130 LogFatal(
"[!] Could not initialize landscape texture!");
145 Surfaces[i] =
nullptr;
147 if (hMaterialTexture) glDeleteTextures(1, &hMaterialTexture);
148 hMaterialTexture = 0;
149 if (matMapTexture) glDeleteTextures(1, &matMapTexture);
154 glDeleteBuffers(1, &hVBO);
158 if (hVAOIDLight != 0)
164 if (hVAOIDNoLight != 0)
171 bool C4LandscapeRenderGL::InitLandscapeTexture()
184 for(
auto & Surface : Surfaces)
187 if(!Surface->Create(iSfcWdt, iSfcHgt))
194 bool C4LandscapeRenderGL::InitMaterialTexture(
C4TextureMap *pTexs)
198 MaterialTextureMap.emplace_back(
"");
199 AddTexturesFromMap(
pTexs);
202 iMaterialTextureDepth = 2*MaterialTextureMap.size();
203 int32_t iNormalDepth = iMaterialTextureDepth / 2;
209 if (!pRefSfc || pRefSfc->
Wdt < pSfc->Wdt || pRefSfc->
Hgt < pSfc->Hgt)
215 int iTexWdt = pRefSfc->
Wdt, iTexHgt = pRefSfc->
Hgt;
216 GLint iMaxTexSize, iMaxTexLayers;
217 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &iMaxTexSize);
218 glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &iMaxTexLayers);
219 if (iTexWdt > iMaxTexSize || iTexHgt > iMaxTexSize)
221 iTexWdt = std::min(iTexWdt, iMaxTexSize);
222 iTexHgt = std::min(iTexHgt, iMaxTexSize);
223 LogF(
" gl: Material textures too large, GPU only supports %dx%d! Cropping might occur!", iMaxTexSize, iMaxTexSize);
225 if(iMaterialTextureDepth >= iMaxTexLayers)
227 LogF(
" gl: Too many material textures! GPU only supports 3D texture depth of %d!", iMaxTexSize);
230 iMaterialWidth = iTexWdt;
231 iMaterialHeight = iTexHgt;
235 const int iSize = iTexSize * iMaterialTextureDepth;
237 for(
int i = 0; i < iMaterialTextureDepth; i++)
239 BYTE *p = pData + i * iTexSize;
242 bool fNormal = i >= iNormalDepth;
243 if(i < int32_t(MaterialTextureMap.size()))
244 Texture.
Ref(MaterialTextureMap[i]);
245 else if(fNormal && i < iNormalDepth + int32_t(MaterialTextureMap.size()))
246 Texture.
Format(
"%s_NRM", MaterialTextureMap[i-iNormalDepth].getData());
251 #ifdef DEBUG_SOLID_COLOR_TEXTURES
253 DWORD *texdata =
reinterpret_cast<DWORD *
>(p);
254 for (
int y = 0; y < iTexHgt; ++y)
255 for (
int x = 0; x < iTexWdt; ++x)
256 *texdata++ =
RGBA((iTex & 48), (iTex & 3) * 16, (i & 12) * 4, 255);
262 if(pSurface->
Wdt != iTexWdt || pSurface->
Hgt != iTexHgt)
263 if (iTexWdt % pSurface->
Wdt != 0 || iTexHgt % pSurface->
Hgt != 0)
264 LogF(
" gl: texture %s size mismatch (%dx%d vs %dx%d)!", Texture.
getData(), pSurface->
Wdt, pSurface->
Hgt, iTexWdt, iTexHgt);
267 DWORD *texdata =
reinterpret_cast<DWORD *
>(p);
269 for (
int y = 0; y < iTexHgt; ++y)
270 for (
int x = 0; x < iTexWdt; ++x)
271 *texdata++ = pSurface->
GetPixDw(x % pSurface->
Wdt, y % pSurface->
Hgt,
false);
280 DWORD *texdata =
reinterpret_cast<DWORD *
>(p);
281 for (
int y = 0; y < iTexHgt; ++y)
282 for (
int x = 0; x < iTexWdt; ++x)
283 *texdata++ = ((x + y) % 32 < 16 ?
RGBA(255, 0, 0, 255) :
RGBA(0, 255, 255, 255));
290 DWORD *texdata =
reinterpret_cast<DWORD *
>(p);
291 for (
int y = 0; y < iTexHgt; ++y)
292 for (
int x = 0; x < iTexWdt; ++x)
293 *texdata++ =
RGBA(127, 127, 255, 255);
296 memset(p, 0, iTexSize);
300 while(glGetError()) {}
303 glGenTextures(1, &matMapTexture);
306 glGenTextures(1, &hMaterialTexture);
312 glBindTexture(GL_TEXTURE_2D_ARRAY, hMaterialTexture);
313 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
316 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT);
317 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT);
318 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
319 glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
322 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, iTexWdt, iTexHgt, iMaterialTextureDepth, 0, GL_BGRA,
323 GL_UNSIGNED_INT_8_8_8_8_REV,
326 glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
335 if(
int err = glGetError())
337 LogF(
" gl: Could not load textures (error %d)", err);
342 LogF(
" gl: Texturing uses %d slots at %dx%d (%d MB total)",
343 static_cast<int>(MaterialTextureMap.size()),
344 iMaterialWidth, iMaterialHeight,
361 if (To.
Wdt<=0 || To.
Hgt<=0)
return;
368 for (
auto & Surface : Surfaces)
370 if (!Surface->Lock())
return;
371 Surface->ClearBoxDw(To.
x, To.
y, To.
Wdt, To.
Hgt);
379 int *placementSumsUp =
new int [placementSumsWidth * 2];
380 int *placementSumsDown = placementSumsUp + placementSumsWidth;
381 for(x = 0; x < placementSumsWidth; x++)
383 placementSumsUp[x] = 0;
384 placementSumsDown[x] = 0;
385 if (To.
x + x - C4LR_BiasDistanceX < 0 || To.x + x - C4LR_BiasDistanceX >=
iWidth)
continue;
396 texture[i] = Surfaces[i]->texture.get();
399 for(y = 0; y < To.
Hgt; y++)
407 int sumLeft = 0, sumRight = 0;
421 int sumUp = 0, sumDown = 0;
427 for(x = 0; x < To.
Wdt; x++)
429 int pixel = pSource->
_GetPix(To.
x+x, To.
y+y);
434 int horizontalBias = std::max(0, placement * horizontalFactor - sumRight) -
435 std::max(0, placement * horizontalFactor - sumLeft);
437 int verticalBias = std::max(0, placement * verticalFactor - sumDown) -
438 std::max(0, placement * verticalFactor - sumUp);
442 const int maximumPlacementDifference = 40;
443 int horizontalBiasScaled =
Clamp(horizontalBias * 127 / maximumPlacementDifference / horizontalFactor + 128, 0, 255);
444 int verticalBiasScaled =
Clamp(verticalBias * 127 / maximumPlacementDifference / verticalFactor + 128, 0, 255);
448 memset(data, 0,
sizeof(data));
453 data[
C4LR_Scaler] = CalculateScalerBitmask(x, y, To, pSource);
457 texture[i]->SetPix(To.
x+x, To.
y+y,
458 RGBA(data[i*4+0], data[i*4+1], data[i*4+2], data[i*4+3]));
462 if (x < To.
Wdt - 1) {
463 sumLeft -= placementSumsUp[x] + placementSumsDown[x];
466 sumUp -= placementSumsUp[x];
467 sumDown -= placementSumsDown[x];
478 sumLeft += placement;
510 delete[] placementSumsUp;
511 for (
auto & Surface : Surfaces)
522 int C4LandscapeRenderGL::CalculateScalerBitmask(
int x,
int y,
C4Rect To,
C4Landscape *pSource)
524 int pixel = pSource->
_GetPix(To.
x+x, To.
y+y);
527 int neighbours[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
531 neighbours[0] = pSource->
_GetPix(To.
x+x-1, To.
y+y-1);
532 neighbours[1] = pSource->
_GetPix(To.
x+x, To.
y+y-1);
534 neighbours[2] = pSource->
_GetPix(To.
x+x+1, To.
y+y-1);
537 neighbours[3] = pSource->
_GetPix(To.
x+x-1, To.
y+y);
539 neighbours[4] = pSource->
_GetPix(To.
x+x+1, To.
y+y);
543 neighbours[5] = pSource->
_GetPix(To.
x+x-1, To.
y+y+1);
544 neighbours[6] = pSource->
_GetPix(To.
x+x, To.
y+y+1);
546 neighbours[7] = pSource->
_GetPix(To.
x+x+1, To.
y+y+1);
550 int maxPixel = pixel, maxPlacement = placement;
551 for(
int neighbour : neighbours)
554 if(tempPlacement > maxPlacement || (tempPlacement == maxPlacement && neighbour > maxPixel) )
556 maxPixel = neighbour;
557 maxPlacement = tempPlacement;
563 if(maxPixel == pixel)
566 for(
int i = 0; i < 8; i++)
567 if(neighbours[i] == pixel)
573 for(
int i = 0; i < 8; i++)
574 if(neighbours[i] != maxPixel)
580 const char *C4LandscapeRenderGL::UniformNames[
C4LRU_Count+1];
582 bool C4LandscapeRenderGL::LoadShader(
C4GroupSet *pGroups,
C4Shader& shader,
const char* name,
int ssc)
587 if(ssc & C4SSC_LIGHT) shader.
AddDefine(
"OC_DYNAMIC_LIGHT");
607 if (!shader.
Init(name, UniformNames, AttributeNames)) {
615 bool C4LandscapeRenderGL::LoadShaders(
C4GroupSet *pGroups)
621 ZeroMem(UniformNames,
sizeof(UniformNames));
640 if(!LoadShader(pGroups, Shader,
"landscape", 0))
642 if(!LoadShader(pGroups, ShaderLight,
"landscapeLight", C4SSC_LIGHT))
648 bool C4LandscapeRenderGL::InitVBO()
652 glGenBuffers(1, &hVBO);
653 glBindBuffer(GL_ARRAY_BUFFER, hVBO);
654 glBufferData(GL_ARRAY_BUFFER, 24 *
sizeof(
float),
nullptr, GL_STREAM_DRAW);
655 glBindBuffer(GL_ARRAY_BUFFER, 0);
657 assert(hVAOIDLight == 0);
658 assert(hVAOIDNoLight == 0);
664 void C4LandscapeRenderGL::ClearShaders()
679 bool C4LandscapeRenderGL::LoadScaler(
C4GroupSet *pGroups)
683 if(!pGroup)
return false;
688 const int iOrigWdt = 8 * 3, iOrigHgt = 4 * 8 * 3;
689 const int iFactor = fctScaler.
Wdt / iOrigWdt;
690 if(fctScaler.
Wdt != iFactor * iOrigWdt || fctScaler.
Hgt != iFactor * iOrigHgt)
692 LogF(
" gl: Unexpected scaler size - should be multiple of %dx%d!", iOrigWdt, iOrigHgt);
700 for (i = 0; i < 8 * 4 * 8; i++) {
702 enum Px { NW, N, NE, W, E, SW, S, SE,
X };
703 int p_x[9] = { -1, 0, 1, -1, 1, -1, 0, 1, 0 };
704 int p_y[9] = { -1, -1, -1, 0, 0, 1, 1, 1, 0 };
706 for(
int j = 0; j <
X; j++)
707 pxAt[j] = !!(i & (1 << j));
710 enum Oc { NWW, NEE, SWW, SEE, NNW, NNE, SSW, SSE };
711 int p2a[8] = { 5, 6, 7, 4, 0, 3, 2, 1 };
712 Oc a2o[8] = { SEE, SSE, SSW, SWW, NWW, NNW, NNE, NEE };
717 #define INTERPOLATE(x,da) do { \
718 int y = a2o[(8+p2a[x]+(da)) % 8];\
719 if (!pxAt[x] && opx[y] == X) opx[y] = x; \
721 for(
int j = 0; j < 4; j++) {
740 noNormals[NNW] = noNormals[NWW] = !pxAt[W] || !pxAt[NW] || !pxAt[N];
741 noNormals[NNE] = noNormals[NEE] = !pxAt[E] || !pxAt[NE] || !pxAt[N];
742 noNormals[SSW] = noNormals[SWW] = !pxAt[W] || !pxAt[SW] || !pxAt[S];
743 noNormals[SSE] = noNormals[SEE] = !pxAt[E] || !pxAt[SE] || !pxAt[S];
746 const int x0 = (i % 8) * 3 * iFactor;
747 const int y0 = (i / 8) * 3 * iFactor;
748 const int iPxs = 3 * iFactor;
751 for(y = 0; y < iPxs; y++)
753 for(x = 0; x < iPxs; x++)
757 if(2 * x >= iPxs) oct+=1;
758 if(2 * y >= iPxs) oct+=2;
759 if((x >= y) != (x >= iPxs - y)) oct+=4;
763 if(val >= 250) val = 255;
764 BYTE bx = 64 * (p_x[opx[oct]] + 1);
765 BYTE by = 64 * (p_y[opx[oct]] + 1);
766 BYTE bn = (noNormals[oct] ? 255 : 1);
774 int32_t C4LandscapeRenderGL::LookupTextureTransition(
const char *szFrom,
const char *szTo)
777 bool fTransit = !
SEqual(szFrom, szTo);
780 for(i = 1; i < MaterialTextureMap.size(); i++)
782 if(
SEqual(szFrom, MaterialTextureMap[i].getData()))
785 if(!fTransit)
return i;
787 if(i + 1 >= MaterialTextureMap.size())
789 if(
SEqual(szTo, MaterialTextureMap[i+1].getData()))
796 void C4LandscapeRenderGL::AddTextureTransition(
const char *szFrom,
const char *szTo)
799 if (!szFrom || !szTo)
return;
801 if (LookupTextureTransition(szFrom, szTo) >= 0)
return;
802 if (LookupTextureTransition(szTo, szFrom) >= 0)
return;
805 MaterialTextureMap.emplace_back(szFrom);
807 else if(
SEqual(MaterialTextureMap.back().getData(), szFrom))
808 MaterialTextureMap.emplace_back(szTo);
809 else if(
SEqual(MaterialTextureMap.back().getData(), szTo))
810 MaterialTextureMap.emplace_back(szFrom);
814 MaterialTextureMap.emplace_back(szFrom);
815 MaterialTextureMap.emplace_back(szTo);
819 void C4LandscapeRenderGL::AddTextureAnim(
const char *szTextureAnim)
821 if(!szTextureAnim)
return;
822 #ifdef DEBUG_SEPERATOR_TEXTURES
824 uint32_t iStartTexCount = MaterialTextureMap.size();
827 const char *pFrom = szTextureAnim;
831 const char *pTo = strchr(pFrom,
'-');
832 if(!pTo) pTo = szTextureAnim;
else pTo++;
839 if(pTo == szTextureAnim)
break;
842 #ifdef DEBUG_SEPERATOR_TEXTURES
844 if(MaterialTextureMap.size() > iStartTexCount)
849 void C4LandscapeRenderGL::AddTexturesFromMap(
C4TextureMap *pMap)
859 for(int32_t i = 0; (pEntry = pMap->
GetEntry(i)); i++)
865 void C4LandscapeRenderGL::BuildMatMap(uint32_t *pTex)
870 for(
int pix = 0; pix < 256; pix++)
878 pTex[2*pix+1] =
RGBA(0,0,0,255);
884 while((p = strchr(p,
'-'))) { p++; iPhases++; }
891 phase /= iPhaseLength;
897 for(
int iP = 0;; iP++)
900 const char *pTo = strchr(pFrom,
'-');
910 if ((iTrans = LookupTextureTransition(From.
getData(), To.
getData())) >= 0)
911 gTexCoo = float(iTrans) + fmod(phase, 1.0f);
912 else if ((iTrans = LookupTextureTransition(To.
getData(), From.
getData())) >= 0)
913 gTexCoo = float(iTrans) + 1.0 - fmod(phase, 1.0f);
921 int iTexCoo = int((gTexCoo * 256.0 / iMaterialTextureDepth) + 0.5);
927 pTex[2*pix+1] =
RGBA(
946 if (Light) shader = &ShaderLight;
957 float centerX = float(cgo.
TargetX)+float(cgo.
Wdt)/2,
958 centerY = float(cgo.
TargetY)+float(cgo.
Hgt)/2;
960 centerX /
float(Surfaces[0]->Wdt),
961 centerY /
float(Surfaces[0]->Hgt));
966 const float fMod[4] = {
967 ((clrMod >> 16) & 0xff) / 255.0f,
968 ((clrMod >> 8) & 0xff) / 255.0f,
969 ((clrMod ) & 0xff) / 255.0f,
970 ((clrMod >> 24) & 0xff) / 255.0f
979 float ambientTransform[6];
987 const auto now = std::chrono::steady_clock::now();
988 const int epoch = std::chrono::duration_cast<std::chrono::milliseconds>(now - TimerStart).count();
999 iLandscapeUnits[i] = ShaderCall.
AllocTexUnit(-1) - GL_TEXTURE0;
1000 glBindTexture(GL_TEXTURE_2D, Surfaces[i]->texture->texName);
1003 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1004 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1008 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1009 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1017 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1018 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1026 glBindTexture(GL_TEXTURE_2D, fctScaler.
Surface->
texture->texName);
1027 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1028 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1032 glBindTexture(GL_TEXTURE_2D_ARRAY, hMaterialTexture);
1036 uint32_t MatMap[2*256];
1037 BuildMatMap(MatMap);
1038 glBindTexture(GL_TEXTURE_1D, matMapTexture);
1039 glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 2*256, 0, GL_RGBA, GL_UNSIGNED_BYTE, MatMap);
1040 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1041 glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1047 fTexBlt.
left = fx / Surfaces[0]->Wdt;
1048 fTexBlt.
top = fy / Surfaces[0]->Hgt;
1049 fTexBlt.
right = (fx + float(cgo.
Wdt)) / Surfaces[0]->Wdt;
1050 fTexBlt.
bottom= (fy + float(cgo.
Hgt)) / Surfaces[0]->Hgt;
1054 float tx = float(cgo.
X), ty = float(cgo.
Y);
1062 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1066 float* pos = &vtxData[0];
1067 float* tex = &vtxData[8];
1068 float* lightTex = &vtxData[16];
1070 pos[0] = tTexBlt.
left;
1071 pos[1] = tTexBlt.
top;
1072 pos[2] = tTexBlt.
right;
1073 pos[3] = tTexBlt.
top;
1074 pos[4] = tTexBlt.
left;
1076 pos[6] = tTexBlt.
right;
1079 tex[0] = fTexBlt.
left;
1080 tex[1] = fTexBlt.
top;
1081 tex[2] = fTexBlt.
right;
1082 tex[3] = fTexBlt.
top;
1083 tex[4] = fTexBlt.
left;
1085 tex[6] = fTexBlt.
right;
1088 unsigned int nFloats = 16;
1095 lTexBlt.
left = (fx - LightRect.
x) / iLightWdt;
1096 lTexBlt.
top = 1.0 - (fy - LightRect.
y) / iLightHgt;
1097 lTexBlt.
right = (fx + cgo.
Wdt - LightRect.
x) / iLightWdt;
1098 lTexBlt.
bottom = 1.0 - (fy + cgo.
Hgt - LightRect.
y) / iLightHgt;
1100 lightTex[0] = lTexBlt.
left;
1101 lightTex[1] = lTexBlt.
top;
1102 lightTex[2] = lTexBlt.
right;
1103 lightTex[3] = lTexBlt.
top;
1104 lightTex[4] = lTexBlt.
left;
1105 lightTex[5] = lTexBlt.
bottom;
1106 lightTex[6] = lTexBlt.
right;
1107 lightTex[7] = lTexBlt.
bottom;
1112 glBindBuffer(GL_ARRAY_BUFFER, hVBO);
1113 glBufferSubData(GL_ARRAY_BUFFER, 0, nFloats *
sizeof(
float), vtxData);
1116 unsigned int vaoid = Light ? hVAOIDLight : hVAOIDNoLight;
1118 const bool has_vao =
pGL->
GetVAO(vaoid, vao);
1119 glBindVertexArray(vao);
1135 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
1138 glBindVertexArray(0);
1139 glBindBuffer(GL_ARRAY_BUFFER, 0);
#define C4CFN_LandscapeScaler
int32_t PixCol2Mat(BYTE pixc)
int32_t PixCol2Tex(BYTE pixc)
const int C4LR_BiasDistanceY
const int C4LR_BiasDistanceX
const char *const SEPERATOR_TEXTURE
#define INTERPOLATE(x, da)
const int C4LR_SurfaceCount
@ C4LRU_AmbientBrightness
@ C4LRA_LandscapeTexCoord
bool LogF(const char *strMessage,...)
bool LogFatal(const char *szMessage)
int32_t MatPlacement(int32_t mat)
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
T Clamp(T bval, T lbound, T rbound)
bool SEqual(const char *szStr1, const char *szStr2)
uint32_t RGBA(uint32_t r, uint32_t g, uint32_t b, uint32_t a)
#define GetGreenValue(rgb)
static constexpr int COLOR_DEPTH_BYTES
C4Rect GetClipRect() const
C4Rect GetOutRect() const
C4ScriptUniform scriptUniform
void ApplyZoom(float &X, float &Y)
bool Load(C4Group &hGroup, const char *szName, int iWdt, int iHgt, bool fNoErrIfNotFound, int iFlags)
void GetFragTransform(const struct FLOAT_RECT &vpRect, const C4Rect &clipRect, const C4Rect &outRect, float ambientTransform[6]) const
double GetBrightness() const
GLuint getSurfaceName() const
int32_t getSurfaceHeight() const
const C4Rect & getRegion() const
const C4FoW * getFoW() const
const FLOAT_RECT & getViewportRegion() const
int32_t getSurfaceWidth() const
C4Group * FindEntry(const char *szWildcard, int32_t *pPriority=nullptr, int32_t *pID=nullptr)
BYTE _GetPix(int32_t x, int32_t y) const
int32_t _GetPlacement(int32_t x, int32_t y) const
C4Rect GetAffectedRect(C4Rect Rect) override
bool ReInit(int32_t iWidth, int32_t iHeight) override
~C4LandscapeRenderGL() override
void Draw(const C4TargetFacet &cgo, const C4FoWRegion *Light, uint32_t clrMod) override
void Update(C4Rect Rect, C4Landscape *pSource) override
bool Init(int32_t iWidth, int32_t iHeight, C4TextureMap *pMap, C4GroupSet *pGraphics) override
void Enlarge(int32_t iByX, int32_t iByY)
void Intersect(const C4Rect &r2)
void SetUniform1f(int iUniform, float gX) const
void SetUniformMatrix4x4(int iUniform, const StdMeshMatrix &matrix)
GLint AllocTexUnit(int iUniform)
void SetUniform2f(int iUniform, float gX, float gY) const
void SetUniform4fv(int iUniform, int iLength, const float *pVals) const
void SetUniform1iv(int iUniform, int iLength, const int *pVals) const
void SetUniform3fv(int iUniform, int iLength, const float *pVals) const
void SetUniformMatrix2x3fv(int iUniform, int iLength, const float *pVals) const
void SetUniform1i(int iUniform, int iX) const
bool LoadVertexSlices(C4GroupSet *pGroupSet, const char *szFile)
bool LoadFragmentSlices(C4GroupSet *pGroupSet, const char *szFile)
void AddDefine(const char *name)
GLint GetAttribute(int iAttribute) const
bool HaveUniform(int iUniform) const
void SetScriptCategories(const std::vector< std::string > &categories)
bool Init(const char *szWhat, const char **szUniforms, const char **szAttributes)
bool SetPixDw(int iX, int iY, DWORD dwCol)
DWORD GetPixDw(int iX, int iY, bool fApplyModulation)
std::unique_ptr< C4TexRef > texture
const char * GetTextureName() const
C4Material * GetMaterial() const
const char * GetTexture(int32_t iIndex)
const C4TexMapEntry * GetEntry(int32_t iIndex) const
static C4TimeMilliseconds Now()
const StdProjectionMatrix & GetProjectionMatrix() const
bool PrepareRendering(C4Surface *sfcToSurface) override
void FreeVAOID(unsigned int vaoid)
bool GetVAO(unsigned int vaoid, GLuint &vao)
void CopyUntil(const char *szString, char cUntil)
void Ref(const char *pnData)
const char * getData() const
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O