added FXAA antialiasing
This commit is contained in:
parent
583e1be2c4
commit
f44f872c49
255
lwjgl-rundir/resources/glsl/fxaa.glsl
Normal file
255
lwjgl-rundir/resources/glsl/fxaa.glsl
Normal file
|
@ -0,0 +1,255 @@
|
|||
#line 0
|
||||
|
||||
precision lowp int;
|
||||
precision lowp sampler2D;
|
||||
precision lowp float;
|
||||
|
||||
in vec2 pos;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#define FXAA_PC 1
|
||||
#define FXAA_GLSL_130 1
|
||||
#define FXAA_FAST_PIXEL_OFFSET 0
|
||||
#define FXAA_GATHER4_ALPHA 0
|
||||
|
||||
#ifndef FXAA_GREEN_AS_LUMA
|
||||
// For those using non-linear color,
|
||||
// and either not able to get luma in alpha, or not wanting to,
|
||||
// this enables FXAA to run using green as a proxy for luma.
|
||||
// So with this enabled, no need to pack luma in alpha.
|
||||
//
|
||||
// This will turn off AA on anything which lacks some amount of green.
|
||||
// Pure red and blue or combination of only R and B, will get no AA.
|
||||
//
|
||||
// Might want to lower the settings for both,
|
||||
// fxaaConsoleEdgeThresholdMin
|
||||
// fxaaQualityEdgeThresholdMin
|
||||
// In order to insure AA does not get turned off on colors
|
||||
// which contain a minor amount of green.
|
||||
//
|
||||
// 1 = On.
|
||||
// 0 = Off.
|
||||
//
|
||||
#define FXAA_GREEN_AS_LUMA 1
|
||||
#endif
|
||||
|
||||
#ifndef FXAA_DISCARD
|
||||
// 1 = Use discard on pixels which don't need AA.
|
||||
// 0 = Return unchanged color on pixels which don't need AA.
|
||||
#define FXAA_DISCARD 0
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
API PORTING
|
||||
============================================================================*/
|
||||
#define FxaaBool bool
|
||||
#define FxaaDiscard discard
|
||||
#define FxaaFloat float
|
||||
#define FxaaFloat2 vec2
|
||||
#define FxaaFloat3 vec3
|
||||
#define FxaaFloat4 vec4
|
||||
#define FxaaHalf float
|
||||
#define FxaaHalf2 vec2
|
||||
#define FxaaHalf3 vec3
|
||||
#define FxaaHalf4 vec4
|
||||
#define FxaaInt2 ivec2
|
||||
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
||||
#define FxaaTex sampler2D
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#define FxaaTexTop(t, p) texture(t, p)
|
||||
|
||||
/*============================================================================
|
||||
GREEN AS LUMA OPTION SUPPORT FUNCTION
|
||||
============================================================================*/
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return dot(rgba.xyz, vec3(0.299, 0.587, 0.114)); }
|
||||
#else
|
||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
FXAA3 CONSOLE - PC VERSION
|
||||
============================================================================*/
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 FxaaPixelShader(
|
||||
// See FXAA Quality FxaaPixelShader() source for docs on Inputs!
|
||||
//
|
||||
// Use noperspective interpolation here (turn off perspective interpolation).
|
||||
// {xy} = center of pixel
|
||||
FxaaFloat2 pos,
|
||||
//
|
||||
// Used only for FXAA Console, and not used on the 360 version.
|
||||
// Use noperspective interpolation here (turn off perspective interpolation).
|
||||
// {xy__} = upper left of pixel
|
||||
// {__zw} = lower right of pixel
|
||||
FxaaFloat4 fxaaConsolePosPos,
|
||||
//
|
||||
// Input color texture.
|
||||
// {rgb_} = color in linear or perceptual color space
|
||||
// if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// {___a} = luma in perceptual color space (not linear)
|
||||
FxaaTex tex,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This must be from a constant/uniform.
|
||||
// This effects sub-pixel AA quality and inversely sharpness.
|
||||
// Where N ranges between,
|
||||
// N = 0.50 (default)
|
||||
// N = 0.33 (sharper)
|
||||
// {x___} = -N/screenWidthInPixels
|
||||
// {_y__} = -N/screenHeightInPixels
|
||||
// {__z_} = N/screenWidthInPixels
|
||||
// {___w} = N/screenHeightInPixels
|
||||
FxaaFloat4 fxaaConsoleRcpFrameOpt,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// Not used on 360, but used on PS3 and PC.
|
||||
// This must be from a constant/uniform.
|
||||
// {x___} = -2.0/screenWidthInPixels
|
||||
// {_y__} = -2.0/screenHeightInPixels
|
||||
// {__z_} = 2.0/screenWidthInPixels
|
||||
// {___w} = 2.0/screenHeightInPixels
|
||||
FxaaFloat4 fxaaConsoleRcpFrameOpt2,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only three safe values here: 2 and 4 and 8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// For all other platforms can be a non-power of two.
|
||||
// 8.0 is sharper (default!!!)
|
||||
// 4.0 is softer
|
||||
// 2.0 is really soft (good only for vector graphics inputs)
|
||||
FxaaFloat fxaaConsoleEdgeSharpness,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only two safe values here: 1/4 and 1/8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// The console setting has a different mapping than the quality setting.
|
||||
// Other platforms can use other values.
|
||||
// 0.125 leaves less aliasing, but is softer (default!!!)
|
||||
// 0.25 leaves more aliasing, and is sharper
|
||||
FxaaFloat fxaaConsoleEdgeThreshold,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Trims the algorithm from processing darks.
|
||||
// The console setting has a different mapping than the quality setting.
|
||||
// This does not apply to PS3,
|
||||
// PS3 was simplified to avoid more shader instructions.
|
||||
// 0.06 - faster but more aliasing in darks
|
||||
// 0.05 - default
|
||||
// 0.04 - slower and less aliasing in darks
|
||||
// Special notes when using FXAA_GREEN_AS_LUMA,
|
||||
// Likely want to set this to zero.
|
||||
// As colors that are mostly not-green
|
||||
// will appear very dark in the green channel!
|
||||
// Tune by looking at mostly non-green content,
|
||||
// then start at zero and increase until aliasing is a problem.
|
||||
FxaaFloat fxaaConsoleEdgeThresholdMin
|
||||
) {
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy));
|
||||
FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw));
|
||||
FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy));
|
||||
FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw));
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy);
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
FxaaFloat lumaM = FxaaLuma(rgbyM);
|
||||
#else
|
||||
FxaaFloat lumaM = rgbyM.y;
|
||||
#endif
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw);
|
||||
lumaNe += 1.0/384.0;
|
||||
FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe);
|
||||
FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);
|
||||
FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMinM = min(lumaMin, lumaM);
|
||||
FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
|
||||
FxaaFloat lumaMaxM = max(lumaMax, lumaM);
|
||||
FxaaFloat dirSwMinusNe = lumaSw - lumaNe;
|
||||
FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM;
|
||||
FxaaFloat dirSeMinusNw = lumaSe - lumaNw;
|
||||
if(lumaMaxSubMinM < lumaMaxScaledClamped)
|
||||
{
|
||||
#if (FXAA_DISCARD == 1)
|
||||
FxaaDiscard;
|
||||
#else
|
||||
return rgbyM;
|
||||
#endif
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir;
|
||||
dir.x = dirSwMinusNe + dirSeMinusNw;
|
||||
dir.y = dirSwMinusNe - dirSeMinusNw;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir1 = normalize(dir.xy);
|
||||
FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw);
|
||||
FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;
|
||||
FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir2x = dir2 * fxaaConsoleRcpFrameOpt2.zw;
|
||||
FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2x);
|
||||
FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2x);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 rgbyA = rgbyN1 + rgbyP1;
|
||||
FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
float lumaB = FxaaLuma(rgbyB);
|
||||
#else
|
||||
float lumaB = rgbyB.y;
|
||||
#endif
|
||||
if((lumaB < lumaMin) || (lumaB > lumaMax))
|
||||
rgbyB.xyz = rgbyA.xyz * 0.5;
|
||||
//
|
||||
return rgbyB;
|
||||
}
|
||||
/*==========================================================================*/
|
||||
|
||||
uniform sampler2D f_color;
|
||||
|
||||
uniform vec2 screenSize;
|
||||
|
||||
#define edgeSharpness 7.0
|
||||
#define edgeThreshold 0.1
|
||||
#define edgeThresholdMin 0.005
|
||||
|
||||
void main(){
|
||||
vec4 posPos;
|
||||
posPos.xy = pos - (0.6 / screenSize);
|
||||
posPos.zw = pos + (0.6 / screenSize);
|
||||
vec4 rcpFrameOpt;
|
||||
rcpFrameOpt.xy = vec2(-0.50, -0.50) / screenSize;
|
||||
rcpFrameOpt.zw = vec2( 0.50, 0.50) / screenSize;
|
||||
vec4 rcpFrameOpt2;
|
||||
rcpFrameOpt2.xy = vec2(-2.0, -2.0) / screenSize;
|
||||
rcpFrameOpt2.zw = vec2( 2.0, 2.0) / screenSize;
|
||||
|
||||
fragColor = vec4(FxaaPixelShader(pos, posPos, f_color, rcpFrameOpt, rcpFrameOpt2, edgeSharpness, edgeThreshold, edgeThresholdMin).rgb, 1.0);
|
||||
}
|
13
lwjgl-rundir/resources/glsl/pvert.glsl
Normal file
13
lwjgl-rundir/resources/glsl/pvert.glsl
Normal file
|
@ -0,0 +1,13 @@
|
|||
#line 0
|
||||
|
||||
precision lowp int;
|
||||
precision lowp sampler2D;
|
||||
precision lowp float;
|
||||
|
||||
in vec2 a_pos;
|
||||
|
||||
out vec2 pos;
|
||||
|
||||
void main(){
|
||||
gl_Position = vec4((pos = a_pos) * 2.0 - 1.0, 0.0, 1.0);
|
||||
}
|
|
@ -87,6 +87,10 @@ options.difficulty.hard=Hard
|
|||
options.graphics=Graphics
|
||||
options.graphics.fancy=Fancy
|
||||
options.graphics.fast=Fast
|
||||
options.framebufferAntialias=Antialiasing
|
||||
options.framebufferAntialias.none=None
|
||||
options.framebufferAntialias.auto=Auto
|
||||
options.framebufferAntialias.fxaa=FXAA
|
||||
|
||||
controls.title=Controls
|
||||
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
package net.lax1dude.eaglercraft.glemu;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.*;
|
||||
|
||||
public class EffectPipelineFXAA {
|
||||
|
||||
private static FramebufferGL framebuffer = null;
|
||||
private static RenderbufferGL framebuffer_depth = null;
|
||||
|
||||
private static ProgramGL fxaaProgram = null;
|
||||
private static TextureGL fxaaSourceTexture = null;
|
||||
private static UniformGL fxaaScreenSize = null;
|
||||
|
||||
private static BufferArrayGL renderQuadArray = null;
|
||||
private static BufferGL renderQuadBuffer;
|
||||
|
||||
public static int displayWidth = -1;
|
||||
public static int displayHeight = -1;
|
||||
public static int width = -1;
|
||||
public static int height = -1;
|
||||
|
||||
private static int[] originalViewport = new int[4];
|
||||
|
||||
private static boolean enabled = false;
|
||||
|
||||
private static void initFXAA() {
|
||||
renderQuadArray = _wglCreateVertexArray();
|
||||
renderQuadBuffer = _wglCreateBuffer();
|
||||
|
||||
IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[12]) : ByteBuffer.allocateDirect(12 << 2).order(ByteOrder.nativeOrder()).asIntBuffer());
|
||||
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(0.0f));
|
||||
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
|
||||
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
|
||||
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
|
||||
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(1.0f));
|
||||
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
|
||||
upload.flip();
|
||||
|
||||
_wglBindVertexArray(renderQuadArray);
|
||||
_wglBindBuffer(_wGL_ARRAY_BUFFER, renderQuadBuffer);
|
||||
_wglBufferData0(_wGL_ARRAY_BUFFER, upload, _wGL_STATIC_DRAW);
|
||||
_wglEnableVertexAttribArray(0);
|
||||
_wglVertexAttribPointer(0, 2, _wGL_FLOAT, false, 8, 0);
|
||||
|
||||
ShaderGL pvert_shader = _wglCreateShader(_wGL_VERTEX_SHADER);
|
||||
|
||||
_wglShaderSource(pvert_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/pvert.glsl"));
|
||||
_wglCompileShader(pvert_shader);
|
||||
|
||||
if (!_wglGetShaderCompiled(pvert_shader)) System.err.println(("\n" + _wglGetShaderInfoLog(pvert_shader)).replace("\n", "\n[/glsl/pvert.glsl] ") + "\n");
|
||||
|
||||
ShaderGL fxaa_shader = _wglCreateShader(_wGL_FRAGMENT_SHADER);
|
||||
_wglShaderSource(fxaa_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/fxaa.glsl"));
|
||||
_wglCompileShader(fxaa_shader);
|
||||
|
||||
if (!_wglGetShaderCompiled(fxaa_shader)) System.err.println(("\n" + _wglGetShaderInfoLog(fxaa_shader)).replace("\n", "\n[/glsl/fxaa.glsl] ") + "\n");
|
||||
|
||||
fxaaProgram = _wglCreateProgram();
|
||||
_wglAttachShader(fxaaProgram, pvert_shader);
|
||||
_wglAttachShader(fxaaProgram, fxaa_shader);
|
||||
_wglLinkProgram(fxaaProgram);
|
||||
_wglDetachShader(fxaaProgram, pvert_shader);
|
||||
_wglDetachShader(fxaaProgram, fxaa_shader);
|
||||
_wglDeleteShader(pvert_shader);
|
||||
_wglDeleteShader(fxaa_shader);
|
||||
|
||||
if(!_wglGetProgramLinked(fxaaProgram)) {
|
||||
System.err.println(("\n"+_wglGetProgramInfoLog(fxaaProgram)).replace("\n", "\n[/glsl/fxaa.glsl][LINKER] ") + "\n");
|
||||
fxaaProgram = null;
|
||||
throw new RuntimeException("Invalid shader code");
|
||||
}
|
||||
|
||||
_wglUseProgram(fxaaProgram);
|
||||
|
||||
UniformGL c = _wglGetUniformLocation(fxaaProgram, "f_color");
|
||||
if(c != null) _wglUniform1i(c, 0);
|
||||
|
||||
fxaaScreenSize = _wglGetUniformLocation(fxaaProgram, "screenSize");
|
||||
|
||||
framebuffer = _wglCreateFramebuffer();
|
||||
fxaaSourceTexture = _wglGenTextures();
|
||||
|
||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
|
||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
|
||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
|
||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
|
||||
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
|
||||
framebuffer_depth = _wglCreateRenderBuffer();
|
||||
_wglBindRenderbuffer(framebuffer_depth);
|
||||
_wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height);
|
||||
|
||||
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
|
||||
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, fxaaSourceTexture);
|
||||
_wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, framebuffer_depth);
|
||||
}
|
||||
|
||||
public static void beginPipelineRender() {
|
||||
if(displayWidth <= 0 || displayHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
int mode = Minecraft.getMinecraft().gameSettings.antialiasing;
|
||||
enabled = false;
|
||||
if(mode == 1) enabled = Minecraft.getMinecraft().gameSettings.fancyGraphics;
|
||||
if(mode == 2) enabled = true;
|
||||
if(!enabled) {
|
||||
return;
|
||||
}
|
||||
//_wglGetParameter(_wGL_VIEWPORT, 4, originalViewport);
|
||||
if (displayWidth != width || displayHeight != height) {
|
||||
width = displayWidth;
|
||||
height = displayHeight;
|
||||
originalViewport[0] = 0;
|
||||
originalViewport[1] = 0;
|
||||
originalViewport[2] = width;
|
||||
originalViewport[3] = height;
|
||||
if(fxaaProgram == null) {
|
||||
initFXAA();
|
||||
}else {
|
||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
_wglBindRenderbuffer(framebuffer_depth);
|
||||
_wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height);
|
||||
}
|
||||
}
|
||||
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
|
||||
_wglViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
public static void endPipelineRender() {
|
||||
if(!enabled || displayWidth <= 0 || displayHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
|
||||
_wglClear(_wGL_COLOR_BUFFER_BIT | _wGL_DEPTH_BUFFER_BIT);
|
||||
_wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]);
|
||||
_wglActiveTexture(_wGL_TEXTURE0);
|
||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||
_wglDisable(_wGL_DEPTH_TEST);
|
||||
_wglDisable(_wGL_CULL_FACE);
|
||||
_wglDepthMask(false);
|
||||
_wglUseProgram(fxaaProgram);
|
||||
_wglUniform2f(fxaaScreenSize, width, height);
|
||||
_wglBindVertexArray(renderQuadArray);
|
||||
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
|
||||
_wglEnable(_wGL_DEPTH_TEST);
|
||||
_wglDepthMask(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -396,6 +396,9 @@ public class EntityRenderer {
|
|||
int k = MathHelper.floor_float((int) d2) >> 4;
|
||||
chunkproviderloadorgenerate.func_21110_c(j, k);
|
||||
}
|
||||
EffectPipelineFXAA.displayWidth = this.mc.displayWidth;
|
||||
EffectPipelineFXAA.displayHeight = this.mc.displayHeight;
|
||||
EffectPipelineFXAA.beginPipelineRender();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (mc.gameSettings.anaglyph) {
|
||||
if (i == 0) {
|
||||
|
@ -493,11 +496,13 @@ public class EntityRenderer {
|
|||
func_4135_b(f, i);
|
||||
}
|
||||
if (!mc.gameSettings.anaglyph) {
|
||||
EffectPipelineFXAA.endPipelineRender();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EaglerAdapter.glColorMask(true, true, true, false);
|
||||
EffectPipelineFXAA.endPipelineRender();
|
||||
}
|
||||
|
||||
private void addRainParticles() {
|
||||
|
|
|
@ -63,6 +63,7 @@ public final class EnumOptions extends CompatEnum {
|
|||
public static final EnumOptions DIFFICULTY;
|
||||
public static final EnumOptions GRAPHICS;
|
||||
public static final EnumOptions AMBIENT_OCCLUSION;
|
||||
public static final EnumOptions ANTIALIASING;
|
||||
private final boolean enumFloat;
|
||||
private final boolean enumBoolean;
|
||||
private final String enumString;
|
||||
|
@ -80,7 +81,8 @@ public final class EnumOptions extends CompatEnum {
|
|||
DIFFICULTY = new EnumOptions("DIFFICULTY", 8, "options.difficulty", false, false);
|
||||
GRAPHICS = new EnumOptions("GRAPHICS", 9, "options.graphics", false, false);
|
||||
AMBIENT_OCCLUSION = new EnumOptions("AMBIENT_OCCLUSION", 10, "options.ao", false, true);
|
||||
ANTIALIASING = new EnumOptions("ANTIALIASING", 11, "options.framebufferAntialias", false, false);
|
||||
field_20141_n = (new EnumOptions[] { MUSIC, SOUND, INVERT_MOUSE, SENSITIVITY, RENDER_DISTANCE, VIEW_BOBBING,
|
||||
ANAGLYPH, LIMIT_FRAMERATE, DIFFICULTY, GRAPHICS, AMBIENT_OCCLUSION });
|
||||
ANAGLYPH, LIMIT_FRAMERATE, DIFFICULTY, GRAPHICS, AMBIENT_OCCLUSION, ANTIALIASING });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class GameSettings {
|
|||
limitFramerate = false;
|
||||
fancyGraphics = true;
|
||||
field_22278_j = true;
|
||||
antialiasing = 1;
|
||||
skin = "Default";
|
||||
keyBindForward = new KeyBinding("key.forward", 17);
|
||||
keyBindLeft = new KeyBinding("key.left", 30);
|
||||
|
@ -61,6 +62,7 @@ public class GameSettings {
|
|||
limitFramerate = false;
|
||||
fancyGraphics = true;
|
||||
field_22278_j = true;
|
||||
antialiasing = 1;
|
||||
skin = "Default";
|
||||
keyBindForward = new KeyBinding("key.forward", 17);
|
||||
keyBindLeft = new KeyBinding("key.left", 30);
|
||||
|
@ -142,6 +144,9 @@ public class GameSettings {
|
|||
field_22278_j = !field_22278_j;
|
||||
mc.renderGlobal.loadRenderers();
|
||||
}
|
||||
if (enumoptions == EnumOptions.ANTIALIASING) {
|
||||
antialiasing = (antialiasing + i) % 3;
|
||||
}
|
||||
saveOptions();
|
||||
}
|
||||
|
||||
|
@ -219,6 +224,10 @@ public class GameSettings {
|
|||
return (new StringBuilder()).append(s).append(stringtranslate.translateKey(DIFFICULTIES[difficulty]))
|
||||
.toString();
|
||||
}
|
||||
if (enumoptions == EnumOptions.ANTIALIASING) {
|
||||
return (new StringBuilder()).append(s).append(stringtranslate.translateKey(ANTIALIASING_MODES[antialiasing]))
|
||||
.toString();
|
||||
}
|
||||
if (enumoptions == EnumOptions.GRAPHICS) {
|
||||
if (fancyGraphics) {
|
||||
return (new StringBuilder()).append(s).append(stringtranslate.translateKey("options.graphics.fancy"))
|
||||
|
@ -273,6 +282,9 @@ public class GameSettings {
|
|||
if (as[0].equals("ao")) {
|
||||
field_22278_j = as[1].equals("true");
|
||||
}
|
||||
if (as[0].equals("antialiasing")) {
|
||||
antialiasing = Integer.parseInt(as[1]);
|
||||
}
|
||||
if (as[0].equals("skin")) {
|
||||
skin = as[1];
|
||||
}
|
||||
|
@ -321,6 +333,7 @@ public class GameSettings {
|
|||
printwriter.println((new StringBuilder()).append("difficulty:").append(difficulty).toString());
|
||||
printwriter.println((new StringBuilder()).append("fancyGraphics:").append(fancyGraphics).toString());
|
||||
printwriter.println((new StringBuilder()).append("ao:").append(field_22278_j).toString());
|
||||
printwriter.println((new StringBuilder()).append("antialiasing:").append(antialiasing).toString());
|
||||
printwriter.println((new StringBuilder()).append("skin:").append(skin).toString());
|
||||
printwriter.println((new StringBuilder()).append("lastServer:").append(lastServer).toString());
|
||||
for (int i = 0; i < keyBindings.length; i++) {
|
||||
|
@ -339,6 +352,8 @@ public class GameSettings {
|
|||
"options.renderDistance.short", "options.renderDistance.tiny" };
|
||||
private static final String DIFFICULTIES[] = { "options.difficulty.peaceful", "options.difficulty.easy",
|
||||
"options.difficulty.normal", "options.difficulty.hard" };
|
||||
private static final String ANTIALIASING_MODES[] = { "options.framebufferAntialias.none", "options.framebufferAntialias.auto",
|
||||
"options.framebufferAntialias.fxaa" };
|
||||
public float musicVolume;
|
||||
public float soundVolume;
|
||||
public float mouseSensitivity;
|
||||
|
@ -349,6 +364,7 @@ public class GameSettings {
|
|||
public boolean limitFramerate;
|
||||
public boolean fancyGraphics;
|
||||
public boolean field_22278_j;
|
||||
public int antialiasing;
|
||||
public String skin;
|
||||
public KeyBinding keyBindForward;
|
||||
public KeyBinding keyBindLeft;
|
||||
|
|
|
@ -66,6 +66,6 @@ public class GuiVideoSettings extends GuiScreen {
|
|||
static {
|
||||
field_22108_k = (new EnumOptions[] { EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE,
|
||||
EnumOptions.LIMIT_FRAMERATE, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING,
|
||||
EnumOptions.AMBIENT_OCCLUSION });
|
||||
EnumOptions.AMBIENT_OCCLUSION, EnumOptions.ANTIALIASING });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user