1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-02-24 15:32:30 +01:00

#11 fix title background for hardware (or API) without NPOT support

This commit is contained in:
XProger 2017-09-09 15:31:22 +03:00
parent a4e5e14be6
commit 50625c8796
6 changed files with 42 additions and 45 deletions

View File

@ -446,7 +446,6 @@ namespace Core {
}
void stop() {
glFlush();
if (fpsTime < getTime()) {
LOG("FPS: %d DIP: %d TRI: %d\n", fps, dips, tris);
#ifdef PROFILE
@ -860,13 +859,13 @@ namespace Core {
}
void endFrame() {
Core::stats.stop();
#ifdef __EMSCRIPTEN__
glColorMask(false, false, false, true);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColorMask(true, true, true, true);
#endif
Core::stats.stop();
}
void DIP(int iStart, int iCount) {

View File

@ -944,34 +944,35 @@ namespace TR {
struct {
const char *name;
const char *title;
int ambientTrack;
} LEVEL_INFO[LEVEL_MAX] = {
{ "" , TRACK_CAVES },
{ "TITLE" , TRACK_TITLE },
{ "GYM" , 0 },
{ "LEVEL1" , TRACK_CAVES },
{ "LEVEL2" , TRACK_CAVES },
{ "LEVEL3A" , TRACK_CAVES },
{ "LEVEL3B" , TRACK_CAVES },
{ "CUT1" , TRACK_CUT1 },
{ "LEVEL4" , TRACK_CAVES },
{ "LEVEL5" , TRACK_CAVES },
{ "LEVEL6" , TRACK_CAVES },
{ "LEVEL7A" , TRACK_CISTERN },
{ "LEVEL7B" , TRACK_CISTERN },
{ "CUT2" , TRACK_CUT2 },
{ "LEVEL8A" , TRACK_EGYPT },
{ "LEVEL8B" , TRACK_EGYPT },
{ "LEVEL8C" , TRACK_EGYPT },
{ "LEVEL10A" , TRACK_MINE },
{ "CUT3" , TRACK_CUT3 },
{ "LEVEL10B" , TRACK_MINE },
{ "CUT4" , TRACK_CUT4 },
{ "LEVEL10C" , TRACK_MINE },
{ "EGYPT" , TRACK_EGYPT },
{ "CAT" , TRACK_EGYPT },
{ "END" , TRACK_EGYPT },
{ "END2" , TRACK_EGYPT },
{ "" , "Custom Level", TRACK_CAVES },
{ "TITLE" , "", TRACK_TITLE },
{ "GYM" , "Lara's Home", 0 },
{ "LEVEL1" , "Caves", TRACK_CAVES },
{ "LEVEL2" , "City of Vilcabamba", TRACK_CAVES },
{ "LEVEL3A" , "Lost Valley", TRACK_CAVES },
{ "LEVEL3B" , "Tomb of Qualopec", TRACK_CAVES },
{ "CUT1" , "", TRACK_CUT1 },
{ "LEVEL4" , "St. Francis' Folly", TRACK_CAVES },
{ "LEVEL5" , "Colosseum", TRACK_CAVES },
{ "LEVEL6" , "Palace Midas", TRACK_CAVES },
{ "LEVEL7A" , "The Cistern", TRACK_CISTERN },
{ "LEVEL7B" , "Tomb of Tihocan", TRACK_CISTERN },
{ "CUT2" , "", TRACK_CUT2 },
{ "LEVEL8A" , "City of Khamoon", TRACK_EGYPT },
{ "LEVEL8B" , "Obelisk of Khamoon", TRACK_EGYPT },
{ "LEVEL8C" , "Sanctuary of the Scion", TRACK_EGYPT },
{ "LEVEL10A" , "Natla's Mines", TRACK_MINE },
{ "CUT3" , "", TRACK_CUT3 },
{ "LEVEL10B" , "Atlantis", TRACK_MINE },
{ "CUT4" , "", TRACK_CUT4 },
{ "LEVEL10C" , "The Great Pyramid", TRACK_MINE },
{ "EGYPT" , "Return to Egypt", TRACK_EGYPT },
{ "CAT" , "Temple of the Cat", TRACK_EGYPT },
{ "END" , "Atlantean Stronghold", TRACK_EGYPT },
{ "END2" , "The Hive", TRACK_EGYPT },
};
struct Level {

View File

@ -172,7 +172,7 @@ struct Inventory {
memset(background, 0, sizeof(background));
new Stream("data/TITLEH.PCX", loadTitleBG, this);
new Stream("level/TITLEH.PCX", loadTitleBG, this);
}
phaseRing = phasePage = phaseChoose = phaseSelect = 0.0f;
@ -614,10 +614,14 @@ struct Inventory {
background[1]->bind(sNormal); // blured grayscale image
} else {
game->setShader(Core::passFilter, Shader::DEFAULT, false, false);
float aspectSrc = float(640.0f) / float(480.0f);
float aspectDst = float(Core::width) / float(Core::height);
float aspectImg = aspectDst / aspectSrc;
float ax = 640.0f / float(background[0]->width);
float ay = 480.0f / float(background[0]->height);
float aspect1 = float(background[0]->width) / float(background[0]->height);
float aspect2 = float(Core::width) / float(Core::height);
Core::active.shader->setParam(uParam, vec4(aspect2 / aspect1, -1.0f, 0, 0));
Core::active.shader->setParam(uParam, vec4(ax * aspectImg, -ay, (0.5f - aspectImg * 0.5f) * ax, ay));
}
game->getMesh()->renderQuad();
}

View File

@ -107,7 +107,7 @@
<input type="button" value="Browse Level" onclick="document.getElementById('browseFile').click();" /> (.PHD, .PSX)
<p style="margin:8px">
OpenLara on <a target="_blank" href="https://github.com/XProger/OpenLara">github</a> & <a target="_blank" href="https://www.facebook.com/OpenLaraTR">facebook</a><br>
<br><i>last update: 6.09.2017</i><br>
<br><i>last update: 9.09.2017</i><br>
</p>
</span>

View File

@ -12,9 +12,10 @@ uniform vec4 uParam;
attribute vec4 aCoord;
void main() {
vTexCoord = aCoord.zw;
#ifdef FILTER_DEFAULT
vTexCoord = ((vTexCoord * 2.0 - 1.0) * uParam.xy) * 0.5 + 0.5;
vTexCoord = aCoord.zw * uParam.xy + uParam.zw;
#else
vTexCoord = aCoord.zw;
#endif
gl_Position = vec4(aCoord.xy, 0.0, 1.0);
}

View File

@ -199,17 +199,9 @@ struct Texture {
Color32 *data = (Color32*)&palette[256];
memset(data, 0, dw * dh * 4);
Color32 *ptr = data;
/*
for (i = 0; i < pcx.height * pcx.width; i++) {
Color24 &c = palette[buffer[i]];
ptr[i].r = c.r;
ptr[i].g = c.g;
ptr[i].b = c.b;
ptr[i].a = 255;
}
*/
// TODO: color bleeding
Color32 *ptr = data;
i = 0;
for (int y = 0; y < pcx.height; y++) {
for (int x = 0; x < pcx.width; x++) {