beta 1.8 title panoramas

This commit is contained in:
Toru the Red Fox 2026-03-03 22:26:33 +00:00
parent 830bc938de
commit 46fcfa6d4f
11 changed files with 149 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -29,8 +29,8 @@ void PauseScreen::init()
}
buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo, L"LBack to game"));
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo, L"LOptions..."));
buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo, L"Back to game")); // typos when making these wchar strings?
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo, L"Options..."));
buttons.push_back(new Button(5, width / 2 - 100, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.achievements")));
buttons.push_back(new Button(6, width / 2 + 2, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.stats")));

View file

@ -248,6 +248,13 @@ wchar_t *Textures::preLoaded[TN_COUNT] =
L"/AH_0008",
L"/AH_0009",*/
L"title/bg/panorama0",
L"title/bg/panorama1",
L"title/bg/panorama2",
L"title/bg/panorama3",
L"title/bg/panorama4",
L"title/bg/panorama5",
L"gui/items",
L"terrain",
};

View file

@ -230,6 +230,13 @@ typedef enum _TEXTURE_NAME
TN_AH_0008,
TN_AH_0009,*/
TN_TITLE_BG_PANORAMA0,
TN_TITLE_BG_PANORAMA1,
TN_TITLE_BG_PANORAMA2,
TN_TITLE_BG_PANORAMA3,
TN_TITLE_BG_PANORAMA4,
TN_TITLE_BG_PANORAMA5,
TN_GUI_ITEMS,
TN_TERRAIN,

View file

@ -52,7 +52,7 @@ TitleScreen::TitleScreen()
void TitleScreen::tick()
{
//vo += 1.0f;
vo += 1.0f;
//if( vo > 100.0f ) minecraft->setScreen(new SelectWorldScreen(this)); // 4J - temp testing
}
@ -128,13 +128,138 @@ void TitleScreen::buttonClicked(Button *button)
}
}
void TitleScreen::renderPanoramas(int xm, int ym, float a)
{
Tesselator* t = Tesselator::getInstance();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPerspective(120.0f, 1.0f, 0.05f, 10.0f);
glMatrixMode(GL_MODELVIEW_MATRIX);
glPushMatrix();
glLoadIdentity();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glDisable(GL_CULL_FACE);
glDepthMask(false);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// CHANGE - performance issues getting these for every loop iteration, get them beforehand
int panoramas[6];
for (int panorama = 0; panorama < 6; panorama++)
panoramas[panorama] = minecraft->textures->loadTexture(TN_TITLE_BG_PANORAMA0 + panorama);
int antialias = 3; // 8 originally, runs terrible here for no visual improvement
for (int l = 0; l < antialias * antialias; l++) {
glPushMatrix();
float x = ((float)(l % antialias) / (float)antialias - 0.5F) / 64.0f;
float y = ((float)(l / antialias) / (float)antialias - 0.5F) / 64.0f;
float z = 0.0F;
glTranslatef(x, y, z);
glRotatef(Mth::sin((vo + a) / 400.0f) * 25.0f + 20.0f, 1.0f, 0.0f, 0.0f);
glRotatef(-(vo + a) * 0.1f, 0.0f, 1.0f, 0.0f);
for (int panorama = 0; panorama < 6; panorama++) {
glPushMatrix();
if (panorama == 1) {
glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
}
if (panorama == 2) {
glRotatef(180.f, 0.0f, 1.0f, 0.0f);
}
if (panorama == 3) {
glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
}
if (panorama == 4) {
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
}
if (panorama == 5) {
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
}
//GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.textures
// .loadTexture((new StringBuilder()).append("/title/bg/panorama").append(i1).append(
// ".png").toString()));
glBindTexture(GL_TEXTURE_2D, panoramas[panorama]);
t->begin();
t->color(0xffffff, 255 / (l + 1));
float f4 = 0.0F;
t->vertexUV(-1.0, -1.0, 1.0, 0.0f + f4, 0.0f + f4);
t->vertexUV(1.0, -1.0, 1.0, 1.0f - f4, 0.0f + f4);
t->vertexUV(1.0, 1.0, 1.0, 1.0f - f4, 1.0f - f4);
t->vertexUV(-1.0, 1.0, 1.0, 0.0f + f4, 1.0f - f4);
t->end();
glPopMatrix();
}
glPopMatrix();
glColorMask(true, true, true, false);
}
t->offset(0, 0, 0);
glColorMask(true, true, true, true);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW_MATRIX);
glPopMatrix();
glDepthMask(true);
glEnable(GL_CULL_FACE);
glEnable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST);
}
void TitleScreen::renderGaussianBlur(float f)
{
// TODO - do something about glCopyTexSubImage2D
//glBindTexture(GL_TEXTURE_2D, blurBuffer);
//glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glColorMask(true, true, true, false);
//Tesselator *t = Tesselator::getInstance();
//t->begin();
//byte blurSamples = 3;
//for (int i = 0; i < blurSamples; i++) {
// t->color(1.0f, 1.0f, 1.0f, 1.0f / (i + 1));
// int j = width;
// int k = height;
// float f1 = (i - blurSamples / 2) / 256.0f;
// t->vertexUV(j, k, blitOffset, 0.0F + f1, 0.0);
// t->vertexUV(j, 0, blitOffset, 1.0F + f1, 0.0);
// t->vertexUV(0, 0, blitOffset, 1.0F + f1, 1.0);
// t->vertexUV(0, k, blitOffset, 0.0F + f1, 1.0);
//}
//
//t->end();
//glColorMask(true, true, true, true);
}
void TitleScreen::renderBackground(int xm, int ym, float a)
{
//renderDirtBackground(0); // TODO - do panoramas
//glViewport(0, 0, 256, 256); // blur doesn't exist
renderPanoramas(xm, ym, a);
//for (int i = 0; i < 8; i++)
// renderGaussianBlur(a);
//glViewport(0, 0, minecraft->width, minecraft->height);
//Tesselator* t = Tesselator::getInstance();
}
void TitleScreen::render(int xm, int ym, float a)
{
// 4J Unused
//#if 0
renderBackground();
renderBackground(xm, ym, a);
Tesselator *t = Tesselator::getInstance();
fillGradient(0, 0, width, height, 0xAAFFFFFF, 0x00FFFFFF); // white
fillGradient(0, 0, width, height, 0x00000000, 0xAA000000); // black
int logoWidth = 155 + 119;
int logoX = width / 2 - logoWidth / 2;
int logoY = 30;
@ -156,7 +281,8 @@ void TitleScreen::render(int xm, int ym, float a)
drawCenteredString(font, splash, 0, -8, 0xffff00);
glPopMatrix();
drawString(font, ClientConstants::VERSION_STRING, 2, 2, 0x505050);
//drawString(font, ClientConstants::VERSION_STRING, 2, 2, 0x505050);
drawString(font, ClientConstants::VERSION_STRING, 2, height - 10, 0xffffff);
wstring msg = L"Copyright Mojang AB. Do not distribute.";
drawString(font, msg, width - font->width(msg) - 2, height - 10, 0xffffff);

View file

@ -23,6 +23,10 @@ public:
virtual void init();
protected:
virtual void buttonClicked(Button *button);
protected:
virtual void renderPanoramas(int xm, int ym, float a);
virtual void renderGaussianBlur(float a);
virtual void renderBackground(int xm, int ym, float a);
public:
virtual void render(int xm, int ym, float a);
};