mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 09:34:35 -05:00
Do not write depth values for translucent blocks (already calculated them in depth pass), remove unused adapative VSync code.
This commit is contained in:
parent
d2fc5bd20e
commit
83b2228896
2 changed files with 4 additions and 22 deletions
|
@ -433,24 +433,6 @@ namespace OpenTK
|
|||
|
||||
if (time > 0)
|
||||
{
|
||||
// Todo: revisit this code. Maybe check average framerate instead?
|
||||
// Note: VSyncMode.Adaptive enables vsync by default. The code below
|
||||
// is supposed to disable vsync if framerate becomes too low (half of target
|
||||
// framerate in the current approach) and reenable once the framerate
|
||||
// rises again.
|
||||
// Note 2: calling Context.VSync = true repeatedly seems to cause jitter on
|
||||
// some configurations. If possible, we should avoid repeated calls.
|
||||
// Note 3: we may not read/write the VSync property without a current context.
|
||||
// This may come to pass if the user has moved rendering to his own thread.
|
||||
if (Context.IsCurrent && VSync == VSyncMode.Adaptive && TargetRenderPeriod != 0)
|
||||
{
|
||||
// Check if we have enough time for a vsync
|
||||
if (RenderTime > 2.0 * TargetRenderPeriod)
|
||||
Context.VSync = false;
|
||||
else
|
||||
Context.VSync = true;
|
||||
}
|
||||
|
||||
render_period = render_args.Time = time;
|
||||
OnRenderFrameInternal(render_args);
|
||||
render_time = render_watch.Elapsed.TotalSeconds;
|
||||
|
|
|
@ -220,18 +220,18 @@ namespace ClassicalSharp {
|
|||
// First fill depth buffer
|
||||
Graphics.ColourWrite = false;
|
||||
for( int batch = 0; batch < _1Dcount; batch++ ) {
|
||||
RenderTranslucentBatchNoAdd( batch );
|
||||
RenderTranslucentBatchDepthPass( batch );
|
||||
}
|
||||
// Then actually draw the transluscent blocks
|
||||
Graphics.AlphaBlending = true;
|
||||
Graphics.Texturing = true;
|
||||
Graphics.ColourWrite = true;
|
||||
//Graphics.DepthWrite = false; TODO: test if this makes a difference.
|
||||
Graphics.DepthWrite = false; // we already calculated depth values in depth pass
|
||||
for( int batch = 0; batch < _1Dcount; batch++ ) {
|
||||
Graphics.Bind2DTexture( texIds[batch] );
|
||||
RenderTranslucentBatch( batch );
|
||||
}
|
||||
//Graphics.DepthWrite = true;
|
||||
Graphics.DepthWrite = true;
|
||||
Graphics.AlphaTest = false;
|
||||
Graphics.AlphaBlending = false;
|
||||
Graphics.Texturing = false;
|
||||
|
@ -333,7 +333,7 @@ namespace ClassicalSharp {
|
|||
}
|
||||
}
|
||||
|
||||
void RenderTranslucentBatchNoAdd( int batch ) {
|
||||
void RenderTranslucentBatchDepthPass( int batch ) {
|
||||
for( int i = 0; i < chunks.Length; i++ ) {
|
||||
ChunkInfo info = chunks[i];
|
||||
if( info.TranslucentParts == null || !info.Visible ) continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue