Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
-Disable GBuffer for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassunshine committed Jan 22, 2024
1 parent d64b822 commit ef190f8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Client/Content/shaders/terrain.v.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void vert(vec3 position, int packedColor, int packedUV, float ao, vec2 uvMin, ve
o_uvMax = uvMax;
}

void frag(vec4 color, vec2 uv, float distance, vec2 uvMin, vec2 uvMax, out vec4 o_color, out vec4 o_gbuffer){
void frag(vec4 color, vec2 uv, float distance, vec2 uvMin, vec2 uvMax, out vec4 o_color){
o_color = colorNormalAverage(interpolatePixels(uv, uvMin, uvMax, Texture, TextureSampler)) * color;
o_gbuffer = vec4(1, 1, 0, 1);
//o_gbuffer = vec4(1, 1, 0, 1);
}
2 changes: 1 addition & 1 deletion Client/Rendering/GameRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public override void Render(double delta) {

CommandList.SetFramebuffer(Framebuffer.Framebuffer);
CommandList.ClearColorTarget(0, RgbaFloat.Grey);
CommandList.ClearColorTarget(1, RgbaFloat.Green);
//CommandList.ClearColorTarget(1, RgbaFloat.Green);
CommandList.ClearDepthStencil(1);

MainCamera.position = Client.PlayerEntity?.SmoothPosition(Client.smoothFactor) + Client.PlayerEntity?.eyeOffset ?? dvec3.Zero;
Expand Down
8 changes: 4 additions & 4 deletions Client/Rendering/MainFramebuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w
MainColor = AddDependency(factory.CreateTexture(baseDescription));
Normal = AddDependency(factory.CreateTexture(baseDescription));

baseDescription.Format = PixelFormat.R32_Float;
baseDescription.Format = PixelFormat.D24_UNorm_S8_UInt;
baseDescription.Usage = TextureUsage.DepthStencil | TextureUsage.Sampled;

Depth = AddDependency(factory.CreateTexture(baseDescription));
Expand All @@ -72,7 +72,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w
ResolvedMainColor = AddDependency(factory.CreateTexture(baseDescription));
ResolvedNormal = AddDependency(factory.CreateTexture(baseDescription));

baseDescription.Format = PixelFormat.R32_Float;
baseDescription.Format = PixelFormat.D24_UNorm_S8_UInt;
baseDescription.Usage = TextureUsage.DepthStencil | TextureUsage.Sampled;

ResolvedDepth = AddDependency(factory.CreateTexture(baseDescription));
Expand All @@ -81,7 +81,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w
Framebuffer = AddDependency(factory.CreateFramebuffer(new FramebufferDescription {
ColorTargets = new[] {
new FramebufferAttachmentDescription(MainColor, 0),
new FramebufferAttachmentDescription(Normal, 0)
//new FramebufferAttachmentDescription(Normal, 0)
},
DepthTarget = new FramebufferAttachmentDescription(Depth, 0)
}));
Expand All @@ -93,7 +93,7 @@ public void Resolve(RenderSystem renderSystem) {
if (Samples == TextureSampleCount.Count1) return;

renderSystem.MainCommandList.ResolveTexture(MainColor, ResolvedMainColor);
renderSystem.MainCommandList.ResolveTexture(Normal, ResolvedNormal);
//renderSystem.MainCommandList.ResolveTexture(Normal, ResolvedNormal);
//renderSystem.MainCommandList.ResolveTexture(Depth, ResolvedDepth);
}

Expand Down
4 changes: 3 additions & 1 deletion Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public void Run(int tps = 20, string windowTitle = "Game") {
};

var gdo = new GraphicsDeviceOptions {
PreferDepthRangeZeroToOne = true, PreferStandardClipSpaceYDirection = true, SyncToVerticalBlank = true,
PreferDepthRangeZeroToOne = true,
PreferStandardClipSpaceYDirection = true,
SyncToVerticalBlank = true,
};

VeldridStartup.CreateWindowAndGraphicsDevice(wci, gdo, GraphicsBackend.Vulkan, out var nw, out var gd);
Expand Down

0 comments on commit ef190f8

Please sign in to comment.