mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
refactor: configure classic panorama at compile-time
This commit is contained in:
parent
ca276943f2
commit
ad67f4be71
|
|
@ -189,7 +189,6 @@ options.renderDistance.short=Short
|
||||||
options.renderDistance.normal=Normal
|
options.renderDistance.normal=Normal
|
||||||
options.renderDistance.far=Far
|
options.renderDistance.far=Far
|
||||||
options.viewBobbing=View Bobbing
|
options.viewBobbing=View Bobbing
|
||||||
options.classicPanorama=Classic Panorama
|
|
||||||
options.ao=Smooth Lighting
|
options.ao=Smooth Lighting
|
||||||
options.anaglyph=3D Anaglyph
|
options.anaglyph=3D Anaglyph
|
||||||
options.framerateLimit=Performance
|
options.framerateLimit=Performance
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
// 4J - the Option sub-class used to be an java enumerated type, trying to
|
// 4J - the Option sub-class used to be an java enumerated type, trying to
|
||||||
// emulate that functionality here
|
// emulate that functionality here
|
||||||
const Options::Option Options::Option::options[18] = {
|
const Options::Option Options::Option::options[17] = {
|
||||||
Options::Option(L"options.music", true, false),
|
Options::Option(L"options.music", true, false),
|
||||||
Options::Option(L"options.sound", true, false),
|
Options::Option(L"options.sound", true, false),
|
||||||
Options::Option(L"options.invertMouse", false, true),
|
Options::Option(L"options.invertMouse", false, true),
|
||||||
|
|
@ -34,7 +34,6 @@ const Options::Option Options::Option::options[18] = {
|
||||||
Options::Option(L"options.gamma", true, false),
|
Options::Option(L"options.gamma", true, false),
|
||||||
Options::Option(L"options.renderClouds", false, true),
|
Options::Option(L"options.renderClouds", false, true),
|
||||||
Options::Option(L"options.particles", false, false),
|
Options::Option(L"options.particles", false, false),
|
||||||
Options::Option(L"options.classicPanorama", false, true),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Options::Option* Options::Option::MUSIC = &Options::Option::options[0];
|
const Options::Option* Options::Option::MUSIC = &Options::Option::options[0];
|
||||||
|
|
@ -66,8 +65,6 @@ const Options::Option* Options::Option::RENDER_CLOUDS =
|
||||||
&Options::Option::options[15];
|
&Options::Option::options[15];
|
||||||
const Options::Option* Options::Option::PARTICLES =
|
const Options::Option* Options::Option::PARTICLES =
|
||||||
&Options::Option::options[16];
|
&Options::Option::options[16];
|
||||||
const Options::Option* Options::Option::CLASSIC_PANORAMA =
|
|
||||||
&(Options::Option::options[17]);
|
|
||||||
|
|
||||||
const Options::Option* Options::Option::getItem(int id) { return &options[id]; }
|
const Options::Option* Options::Option::getItem(int id) { return &options[id]; }
|
||||||
|
|
||||||
|
|
@ -114,8 +111,6 @@ void Options::init() {
|
||||||
invertYMouse = false;
|
invertYMouse = false;
|
||||||
viewDistance = 0;
|
viewDistance = 0;
|
||||||
bobView = true;
|
bobView = true;
|
||||||
// 4jcraft
|
|
||||||
classicPanorama = false;
|
|
||||||
anaglyph3d = false;
|
anaglyph3d = false;
|
||||||
advancedOpengl = false;
|
advancedOpengl = false;
|
||||||
|
|
||||||
|
|
@ -245,10 +240,6 @@ void Options::toggle(const Options::Option* option, int dir) {
|
||||||
// 4J-PB - changing
|
// 4J-PB - changing
|
||||||
// 4jcraft: uncommented this so that the view bobbing option works
|
// 4jcraft: uncommented this so that the view bobbing option works
|
||||||
if (option == Option::VIEW_BOBBING) bobView = !bobView;
|
if (option == Option::VIEW_BOBBING) bobView = !bobView;
|
||||||
// 4jcraft
|
|
||||||
if (option == Option::CLASSIC_PANORAMA) {
|
|
||||||
classicPanorama = !classicPanorama;
|
|
||||||
}
|
|
||||||
if (option == Option::RENDER_CLOUDS) renderClouds = !renderClouds;
|
if (option == Option::RENDER_CLOUDS) renderClouds = !renderClouds;
|
||||||
if (option == Option::ADVANCED_OPENGL) {
|
if (option == Option::ADVANCED_OPENGL) {
|
||||||
advancedOpengl = !advancedOpengl;
|
advancedOpengl = !advancedOpengl;
|
||||||
|
|
@ -301,8 +292,6 @@ bool Options::getBooleanValue(const Options::Option* item) {
|
||||||
// types
|
// types
|
||||||
if (item == Option::INVERT_MOUSE) return invertYMouse;
|
if (item == Option::INVERT_MOUSE) return invertYMouse;
|
||||||
if (item == Option::VIEW_BOBBING) return bobView;
|
if (item == Option::VIEW_BOBBING) return bobView;
|
||||||
// 4jcraft
|
|
||||||
if (item == Option::CLASSIC_PANORAMA) return classicPanorama;
|
|
||||||
if (item == Option::ANAGLYPH) return anaglyph3d;
|
if (item == Option::ANAGLYPH) return anaglyph3d;
|
||||||
if (item == Option::ADVANCED_OPENGL) return advancedOpengl;
|
if (item == Option::ADVANCED_OPENGL) return advancedOpengl;
|
||||||
if (item == Option::AMBIENT_OCCLUSION) return ambientOcclusion;
|
if (item == Option::AMBIENT_OCCLUSION) return ambientOcclusion;
|
||||||
|
|
@ -415,8 +404,6 @@ void Options::load() {
|
||||||
if (cmds[0] == L"guiScale") guiScale = _fromString<int>(cmds[1]);
|
if (cmds[0] == L"guiScale") guiScale = _fromString<int>(cmds[1]);
|
||||||
if (cmds[0] == L"particles") particles = _fromString<int>(cmds[1]);
|
if (cmds[0] == L"particles") particles = _fromString<int>(cmds[1]);
|
||||||
if (cmds[0] == L"bobView") bobView = cmds[1] == L"true";
|
if (cmds[0] == L"bobView") bobView = cmds[1] == L"true";
|
||||||
// 4jcraft
|
|
||||||
if (cmds[0] == L"classicPanorama") classicPanorama = cmds[1] == L"true";
|
|
||||||
if (cmds[0] == L"anaglyph3d") anaglyph3d = cmds[1] == L"true";
|
if (cmds[0] == L"anaglyph3d") anaglyph3d = cmds[1] == L"true";
|
||||||
if (cmds[0] == L"advancedOpengl") advancedOpengl = cmds[1] == L"true";
|
if (cmds[0] == L"advancedOpengl") advancedOpengl = cmds[1] == L"true";
|
||||||
if (cmds[0] == L"fpsLimit") framerateLimit = _fromString<int>(cmds[1]);
|
if (cmds[0] == L"fpsLimit") framerateLimit = _fromString<int>(cmds[1]);
|
||||||
|
|
@ -471,9 +458,6 @@ void Options::save() {
|
||||||
dos.writeChars(L"guiScale:" + _toString<int>(guiScale));
|
dos.writeChars(L"guiScale:" + _toString<int>(guiScale));
|
||||||
dos.writeChars(L"particles:" + _toString<int>(particles));
|
dos.writeChars(L"particles:" + _toString<int>(particles));
|
||||||
dos.writeChars(L"bobView:" + std::wstring(bobView ? L"true" : L"false"));
|
dos.writeChars(L"bobView:" + std::wstring(bobView ? L"true" : L"false"));
|
||||||
// 4jcraft
|
|
||||||
dos.writeChars(L"classicPanorama:" +
|
|
||||||
std::wstring(classicPanorama ? L"true" : L"false"));
|
|
||||||
dos.writeChars(L"anaglyph3d:" +
|
dos.writeChars(L"anaglyph3d:" +
|
||||||
std::wstring(anaglyph3d ? L"true" : L"false"));
|
std::wstring(anaglyph3d ? L"true" : L"false"));
|
||||||
dos.writeChars(L"advancedOpengl:" +
|
dos.writeChars(L"advancedOpengl:" +
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public:
|
||||||
// 4J - this used to be an enum
|
// 4J - this used to be an enum
|
||||||
class Option {
|
class Option {
|
||||||
public:
|
public:
|
||||||
static const Option options[18];
|
static const Option options[17];
|
||||||
static const Option* MUSIC;
|
static const Option* MUSIC;
|
||||||
static const Option* SOUND;
|
static const Option* SOUND;
|
||||||
static const Option* INVERT_MOUSE;
|
static const Option* INVERT_MOUSE;
|
||||||
|
|
@ -31,7 +31,6 @@ public:
|
||||||
static const Option* GAMMA;
|
static const Option* GAMMA;
|
||||||
static const Option* RENDER_CLOUDS;
|
static const Option* RENDER_CLOUDS;
|
||||||
static const Option* PARTICLES;
|
static const Option* PARTICLES;
|
||||||
static const Option* CLASSIC_PANORAMA;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const bool _isProgress;
|
const bool _isProgress;
|
||||||
|
|
@ -62,7 +61,6 @@ public:
|
||||||
bool invertYMouse;
|
bool invertYMouse;
|
||||||
int viewDistance;
|
int viewDistance;
|
||||||
bool bobView;
|
bool bobView;
|
||||||
bool classicPanorama;
|
|
||||||
bool anaglyph3d;
|
bool anaglyph3d;
|
||||||
bool advancedOpengl;
|
bool advancedOpengl;
|
||||||
int framerateLimit;
|
int framerateLimit;
|
||||||
|
|
|
||||||
|
|
@ -164,204 +164,203 @@ void TitleScreen::buttonClicked(Button* button) {
|
||||||
// method
|
// method
|
||||||
void TitleScreen::renderPanorama(float a) {
|
void TitleScreen::renderPanorama(float a) {
|
||||||
#ifdef ENABLE_JAVA_GUIS
|
#ifdef ENABLE_JAVA_GUIS
|
||||||
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
if (minecraft->options->classicPanorama) {
|
#ifdef CLASSIC_PANORAMA
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluPerspective(120.0f, 1.0f, 0.05f, 10.0f);
|
gluPerspective(120.0f, 1.0f, 0.05f, 10.0f);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
char offsetPasses = 8;
|
char offsetPasses = 8;
|
||||||
|
|
||||||
for (int i = 0; i < (offsetPasses * offsetPasses); i++) {
|
for (int i = 0; i < (offsetPasses * offsetPasses); i++) {
|
||||||
|
glPushMatrix();
|
||||||
|
float x =
|
||||||
|
((float)(i % offsetPasses) / (float)offsetPasses - 0.5f) / 64.0f;
|
||||||
|
float y =
|
||||||
|
((float)(i / offsetPasses) / (float)offsetPasses - 0.5f) / 64.0f;
|
||||||
|
float z = 0.0f;
|
||||||
|
glTranslatef(x, y, z);
|
||||||
|
glRotatef(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 j = 0; j < 6; j++) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
float x = ((float)(i % offsetPasses) / (float)offsetPasses - 0.5f) /
|
|
||||||
64.0f;
|
|
||||||
float y = ((float)(i / offsetPasses) / (float)offsetPasses - 0.5f) /
|
|
||||||
64.0f;
|
|
||||||
float z = 0.0f;
|
|
||||||
glTranslatef(x, y, z);
|
|
||||||
glRotatef(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 j = 0; j < 6; j++) {
|
switch (j) {
|
||||||
glPushMatrix();
|
case 1:
|
||||||
|
glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
|
||||||
switch (j) {
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
|
glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
|
glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 4:
|
||||||
glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
|
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 5:
|
||||||
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||||
break;
|
break;
|
||||||
case 5:
|
default:
|
||||||
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
break;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(
|
|
||||||
TN_TITLE_BG_PANORAMA0 + j));
|
|
||||||
t->begin();
|
|
||||||
t->color(16777215, 255 / (i + 1));
|
|
||||||
t->vertexUV(-1.0f, -1.0f, 1.0f, 0.0f, 0.0f);
|
|
||||||
t->vertexUV(1.0f, -1.0f, 1.0f, 1.0f, 0.0f);
|
|
||||||
t->vertexUV(1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
t->vertexUV(-1.0f, 1.0f, 1.0f, 0.0f, 1.0f);
|
|
||||||
t->end();
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(
|
||||||
|
TN_TITLE_BG_PANORAMA0 + j));
|
||||||
|
t->begin();
|
||||||
|
t->color(16777215, 255 / (i + 1));
|
||||||
|
t->vertexUV(-1.0f, -1.0f, 1.0f, 0.0f, 0.0f);
|
||||||
|
t->vertexUV(1.0f, -1.0f, 1.0f, 1.0f, 0.0f);
|
||||||
|
t->vertexUV(1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
t->vertexUV(-1.0f, 1.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
t->end();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glColorMask(true, true, true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t->offset(0.0f, 0.0f, 0.0f);
|
|
||||||
glColorMask(true, true, true, true);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPopMatrix();
|
|
||||||
glDepthMask(true);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
} else {
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glOrtho(0, width, height, 0, 1000, 3000);
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glTranslatef(0, 0, -2000);
|
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
glDisable(GL_FOG);
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glDepthMask(false);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D,
|
|
||||||
minecraft->textures->loadTexture(TN_TITLE_BG_PANORAMA));
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
|
|
||||||
float off = vo * 0.0004f;
|
|
||||||
|
|
||||||
float screenAspect = (float)width / (float)height;
|
|
||||||
float texAspect = 1748.0f / 144.0f;
|
|
||||||
float scale;
|
|
||||||
if (screenAspect > texAspect) {
|
|
||||||
scale = (float)width / 1748.0f;
|
|
||||||
} else {
|
|
||||||
scale = (float)height / 144.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float texWidth = 1748.0f * scale;
|
|
||||||
float texHeight = 144.0f * scale;
|
|
||||||
float yOff = (height - texHeight) / 2.0f;
|
|
||||||
|
|
||||||
float uMax = off + (texWidth / 1748.0f);
|
|
||||||
|
|
||||||
t->begin(GL_QUADS);
|
|
||||||
t->color(0xffffff, 255);
|
|
||||||
t->vertexUV(0, yOff + texHeight, 0, off, 1.0f);
|
|
||||||
t->vertexUV(texWidth, yOff + texHeight, 0, uMax, 1.0f);
|
|
||||||
t->vertexUV(texWidth, yOff, 0, uMax, 0.0f);
|
|
||||||
t->vertexUV(0, yOff, 0, off, 0.0f);
|
|
||||||
t->end();
|
|
||||||
|
|
||||||
glDepthMask(true);
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
glColorMask(true, true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t->offset(0.0f, 0.0f, 0.0f);
|
||||||
|
glColorMask(true, true, true, true);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
glDepthMask(true);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
#else
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, width, height, 0, 1000, 3000);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glTranslatef(0, 0, -2000);
|
||||||
|
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_FOG);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDepthMask(false);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D,
|
||||||
|
minecraft->textures->loadTexture(TN_TITLE_BG_PANORAMA));
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
float off = vo * 0.0004f;
|
||||||
|
|
||||||
|
float screenAspect = (float)width / (float)height;
|
||||||
|
float texAspect = 1748.0f / 144.0f;
|
||||||
|
float scale;
|
||||||
|
if (screenAspect > texAspect) {
|
||||||
|
scale = (float)width / 1748.0f;
|
||||||
|
} else {
|
||||||
|
scale = (float)height / 144.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float texWidth = 1748.0f * scale;
|
||||||
|
float texHeight = 144.0f * scale;
|
||||||
|
float yOff = (height - texHeight) / 2.0f;
|
||||||
|
|
||||||
|
float uMax = off + (texWidth / 1748.0f);
|
||||||
|
|
||||||
|
t->begin(GL_QUADS);
|
||||||
|
t->color(0xffffff, 255);
|
||||||
|
t->vertexUV(0, yOff + texHeight, 0, off, 1.0f);
|
||||||
|
t->vertexUV(texWidth, yOff + texHeight, 0, uMax, 1.0f);
|
||||||
|
t->vertexUV(texWidth, yOff, 0, uMax, 0.0f);
|
||||||
|
t->vertexUV(0, yOff, 0, off, 0.0f);
|
||||||
|
t->end();
|
||||||
|
|
||||||
|
glDepthMask(true);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4jcraft
|
// 4jcraft
|
||||||
void TitleScreen::renderSkybox(float a) {
|
void TitleScreen::renderSkybox(float a) {
|
||||||
#ifdef ENABLE_JAVA_GUIS
|
#ifdef ENABLE_JAVA_GUIS
|
||||||
if (minecraft->options->classicPanorama) {
|
#ifdef CLASSIC_PANORAMA
|
||||||
glViewport(0, 0, 256, 256);
|
glViewport(0, 0, 256, 256);
|
||||||
}
|
#endif
|
||||||
renderPanorama(a);
|
renderPanorama(a);
|
||||||
if (minecraft->options->classicPanorama) {
|
#ifdef CLASSIC_PANORAMA
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
rotateAndBlur(a);
|
rotateAndBlur(a);
|
||||||
}
|
|
||||||
|
|
||||||
glViewport(0, 0, minecraft->width, minecraft->height);
|
|
||||||
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
|
||||||
t->begin();
|
|
||||||
float aspect =
|
|
||||||
width > height ? 120.0f / (float)width : 120.0f / (float)height;
|
|
||||||
float sWidth = (float)height * aspect / 256.0f;
|
|
||||||
float sHeight = (float)width * aspect / 256.0f;
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
t->color(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
t->vertexUV(0.0f, height, 0.0f, (0.5f - sWidth), (0.5f + sHeight));
|
|
||||||
t->vertexUV(width, height, 0.0f, (0.5f - sWidth), (0.5f - sHeight));
|
|
||||||
t->vertexUV(width, 0.0f, 0.0f, (0.5f + sWidth), (0.5f - sHeight));
|
|
||||||
t->vertexUV(0.0f, 0.0f, 0.0f, (0.5f + sWidth), (0.5f + sHeight));
|
|
||||||
t->end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glViewport(0, 0, minecraft->width, minecraft->height);
|
||||||
|
|
||||||
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
t->begin();
|
||||||
|
float aspect =
|
||||||
|
width > height ? 120.0f / (float)width : 120.0f / (float)height;
|
||||||
|
float sWidth = (float)height * aspect / 256.0f;
|
||||||
|
float sHeight = (float)width * aspect / 256.0f;
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
t->color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
t->vertexUV(0.0f, height, 0.0f, (0.5f - sWidth), (0.5f + sHeight));
|
||||||
|
t->vertexUV(width, height, 0.0f, (0.5f - sWidth), (0.5f - sHeight));
|
||||||
|
t->vertexUV(width, 0.0f, 0.0f, (0.5f + sWidth), (0.5f - sHeight));
|
||||||
|
t->vertexUV(0.0f, 0.0f, 0.0f, (0.5f + sWidth), (0.5f + sHeight));
|
||||||
|
t->end();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4jcraft
|
// 4jcraft
|
||||||
void TitleScreen::rotateAndBlur(float a) {
|
void TitleScreen::rotateAndBlur(float a) {
|
||||||
#ifdef ENABLE_JAVA_GUIS
|
#if defined(ENABLE_JAVA_GUIS) && defined(CLASSIC_PANORAMA)
|
||||||
if (minecraft->options->classicPanorama) {
|
glBindTexture(GL_TEXTURE_2D, viewportTexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, viewportTexture);
|
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
glEnable(GL_BLEND);
|
||||||
glEnable(GL_BLEND);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glColorMask(true, true, true, false);
|
||||||
glColorMask(true, true, true, false);
|
Tesselator* t = Tesselator::getInstance();
|
||||||
Tesselator* t = Tesselator::getInstance();
|
t->begin();
|
||||||
t->begin();
|
char blurPasses = 3;
|
||||||
char blurPasses = 3;
|
|
||||||
|
|
||||||
for (int i = 0; i < blurPasses; i++) {
|
for (int i = 0; i < blurPasses; i++) {
|
||||||
t->color(1.0f, 1.0f, 1.0f, 1.0f / (float)(i + 1));
|
t->color(1.0f, 1.0f, 1.0f, 1.0f / (float)(i + 1));
|
||||||
float offset = (float)(i - blurPasses / 2) / 256.0f;
|
float offset = (float)(i - blurPasses / 2) / 256.0f;
|
||||||
t->vertexUV(width, height, 0.0f, (0.0f + offset), 0.0f);
|
t->vertexUV(width, height, 0.0f, (0.0f + offset), 0.0f);
|
||||||
t->vertexUV(width, 0.0f, 0.0f, (1.0f + offset), 0.0f);
|
t->vertexUV(width, 0.0f, 0.0f, (1.0f + offset), 0.0f);
|
||||||
t->vertexUV(0.0f, 0.0f, 0.0f, (1.0f + offset), 1.0f);
|
t->vertexUV(0.0f, 0.0f, 0.0f, (1.0f + offset), 1.0f);
|
||||||
t->vertexUV(0.0f, height, 0.0f, (0.0f + offset), 1.0f);
|
t->vertexUV(0.0f, height, 0.0f, (0.0f + offset), 1.0f);
|
||||||
}
|
|
||||||
|
|
||||||
t->end();
|
|
||||||
glColorMask(true, true, true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t->end();
|
||||||
|
glColorMask(true, true, true, true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,10 +376,10 @@ void TitleScreen::render(int xm, int ym, float a) {
|
||||||
int logoY = 30;
|
int logoY = 30;
|
||||||
|
|
||||||
// 4jcraft: gradient for classic panorama
|
// 4jcraft: gradient for classic panorama
|
||||||
if (minecraft->options->classicPanorama) {
|
#ifdef CLASSIC_PANORAMA
|
||||||
fillGradient(0, 0, width, height, -2130706433, 16777215);
|
fillGradient(0, 0, width, height, -2130706433, 16777215);
|
||||||
fillGradient(0, 0, width, height, 0, INT_MIN);
|
fillGradient(0, 0, width, height, 0, INT_MIN);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D,
|
glBindTexture(GL_TEXTURE_2D,
|
||||||
minecraft->textures->loadTexture(TN_TITLE_MCLOGO));
|
minecraft->textures->loadTexture(TN_TITLE_MCLOGO));
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ void VideoSettingsScreen::init() {
|
||||||
Options::Option::GUI_SCALE,
|
Options::Option::GUI_SCALE,
|
||||||
Options::Option::ADVANCED_OPENGL,
|
Options::Option::ADVANCED_OPENGL,
|
||||||
Options::Option::GAMMA,
|
Options::Option::GAMMA,
|
||||||
Options::Option::FOV,
|
Options::Option::FOV};
|
||||||
Options::Option::CLASSIC_PANORAMA};
|
|
||||||
|
|
||||||
for (int i = 0; i < ITEM_COUNT; i++) {
|
for (int i = 0; i < ITEM_COUNT; i++) {
|
||||||
const Options::Option* item = items[i];
|
const Options::Option* item = items[i];
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,10 @@ if get_option('enable_vsync')
|
||||||
global_cpp_defs += '-DENABLE_VSYNC'
|
global_cpp_defs += '-DENABLE_VSYNC'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('classic_panorama')
|
||||||
|
global_cpp_defs += '-DCLASSIC_PANORAMA'
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('ui_backend') == 'shiggy'
|
if get_option('ui_backend') == 'shiggy'
|
||||||
shiggy_dep = dependency(
|
shiggy_dep = dependency(
|
||||||
'shiggy',
|
'shiggy',
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@ option('ui_backend',
|
||||||
value : 'shiggy',
|
value : 'shiggy',
|
||||||
description : 'Specifies a backend implementation for the game UI.')
|
description : 'Specifies a backend implementation for the game UI.')
|
||||||
|
|
||||||
|
option('classic_panorama',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Enable classic java edition panorama (ui_backend=java ONLY).')
|
||||||
|
|
||||||
option('enable_vsync',
|
option('enable_vsync',
|
||||||
type : 'boolean',
|
type : 'boolean',
|
||||||
value : true,
|
value : true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue