diff --git a/Minecraft.Client/Common/res/title/bg/panorama0.png b/Minecraft.Client/Common/res/title/bg/panorama0.png new file mode 100644 index 000000000..8ba1daddc Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama0.png differ diff --git a/Minecraft.Client/Common/res/title/bg/panorama1.png b/Minecraft.Client/Common/res/title/bg/panorama1.png new file mode 100644 index 000000000..c16841ad8 Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama1.png differ diff --git a/Minecraft.Client/Common/res/title/bg/panorama2.png b/Minecraft.Client/Common/res/title/bg/panorama2.png new file mode 100644 index 000000000..0436d776b Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama2.png differ diff --git a/Minecraft.Client/Common/res/title/bg/panorama3.png b/Minecraft.Client/Common/res/title/bg/panorama3.png new file mode 100644 index 000000000..2c7ad778e Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama3.png differ diff --git a/Minecraft.Client/Common/res/title/bg/panorama4.png b/Minecraft.Client/Common/res/title/bg/panorama4.png new file mode 100644 index 000000000..03900967d Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama4.png differ diff --git a/Minecraft.Client/Common/res/title/bg/panorama5.png b/Minecraft.Client/Common/res/title/bg/panorama5.png new file mode 100644 index 000000000..0331ad4a9 Binary files /dev/null and b/Minecraft.Client/Common/res/title/bg/panorama5.png differ diff --git a/Minecraft.Client/PauseScreen.cpp b/Minecraft.Client/PauseScreen.cpp index 6a14e3dc1..b43f4b192 100644 --- a/Minecraft.Client/PauseScreen.cpp +++ b/Minecraft.Client/PauseScreen.cpp @@ -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"))); diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index 807bffb6d..f1b0b5522 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -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", }; diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index a39741eb4..479279a5e 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -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, diff --git a/Minecraft.Client/TitleScreen.cpp b/Minecraft.Client/TitleScreen.cpp index 1e0d84fa0..01ee69c0d 100644 --- a/Minecraft.Client/TitleScreen.cpp +++ b/Minecraft.Client/TitleScreen.cpp @@ -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); diff --git a/Minecraft.Client/TitleScreen.h b/Minecraft.Client/TitleScreen.h index 70d374526..2e8591b94 100644 --- a/Minecraft.Client/TitleScreen.h +++ b/Minecraft.Client/TitleScreen.h @@ -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); }; \ No newline at end of file