Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

etc

  • Loading branch information...
commit a6a482c02cd90f96f82032883ef5d51e7ac650e6 1 parent a743b50
@eatfears authored
View
5 blocks/Blocks_Definitions.h
@@ -21,9 +21,9 @@
#define STEP_DOWNSTEP 0.6
#define MAX_DOWNSTEP 7.0
#define PLAYER_HEIGHT 15.0
-#define AIR_ACCEL 0.12
+#define AIR_ACCEL 1.2
#define JUMP_STR 4.0
-#define WALK_SPEED 1000
+#define WALK_SPEED 150
#define SPRINT_KOEF 2.0
@@ -52,6 +52,7 @@ typedef signed short BlockInWorld;
#define GL_EXECUTE 0x1302
#define RENDER_NO_NEED 0
#define RENDER_NEED 1
+#define RENDER_MAYBE 2
#define HASH_SIZE 0x1000
View
20 blocks/Chunk.cpp
@@ -207,9 +207,9 @@ void Chunk::DrawLoadedBlocks()
void Chunk::Generate()
{
- //wWorld.lLandscape.Generate(*this);
+ wWorld.lLandscape.Generate(*this);
//wWorld.lLandscape.Fill(*this, 0, 0.999, 64);
- wWorld.lLandscape.Fill(*this, MAT_DIRT, 1, 64);
+ //wWorld.lLandscape.Fill(*this, MAT_DIRT, 1, 64);
//ChunkPosition pos = {x, z};
//wWorld.lLandscape.Load(pos);
}
@@ -258,11 +258,17 @@ void Chunk::Render(GLenum mode, char mat, int *rendered)
{
mode = GL_COMPILE;
}
+
+ if(NeedToRender[pointertorender] == RENDER_MAYBE)
+ {
- int prob = 1000/(*rendered + 1);
- int r = rand()%1000;
+ int prob = 1000/(*rendered*5 + 1);
+ int r = rand()%1000;
+
+ if(r <= prob)
+ mode = GL_COMPILE;
+ }
- if(r <= prob*2)
if((mode == GL_COMPILE)||(mode == GL_COMPILE_AND_EXECUTE))
{
glNewList(RenderList + pointertorender, mode);
@@ -309,7 +315,9 @@ void Chunk::Render(GLenum mode, char mat, int *rendered)
glEndList();
- (*rendered) ++;
+ if (NeedToRender[pointertorender] = RENDER_MAYBE)
+ (*rendered) ++;
+
NeedToRender[pointertorender] = RENDER_NO_NEED;
}
View
11 blocks/Engine.cpp
@@ -144,7 +144,7 @@ void Engine::Display()
{
#endif // _DEBUG
if (mod == GL_COMPILE)
- (*chunk)->NeedToRender[0] = RENDER_NEED;
+ (*chunk)->NeedToRender[0] = RENDER_MAYBE;
(*chunk)->Render(GL_EXECUTE, MAT_NO, &render);
++chunk;
@@ -175,7 +175,7 @@ void Engine::Display()
{
#endif // _DEBUG
if (mod == GL_COMPILE)
- (*chunk)->NeedToRender[1] = RENDER_NEED;
+ (*chunk)->NeedToRender[1] = RENDER_MAYBE;
(*chunk)->Render(GL_EXECUTE, MAT_WATER, &render);
++chunk;
@@ -361,6 +361,9 @@ void Engine::DrawInterface()
if((player.UnderWater)&&(player.chunk))
{
GLfloat Brightness = Light::LightTable[player.chunk->SkyLight[player.index]];
+ Brightness = Brightness * ( 1.0 - wWorld.SkyBright);
+ //res = res - wWorld.SkyBright;
+
GLdouble TextureRotation = player.dSpinY/90;
glEnable(GL_BLEND);
@@ -368,7 +371,7 @@ void Engine::DrawInterface()
glBindTexture(GL_TEXTURE_2D, wWorld.MaterialLib.texture[UNDERWATER]);
glColor4f(Brightness, Brightness, Brightness, 0.9f);
-
+
glBegin(GL_QUADS);
glTexCoord2d(0.0 - TextureRotation, 0.0);
glVertex2i(WidthBy2- 3*HeightBy2, 0);
@@ -670,5 +673,3 @@ void Engine::GetFogColor()
prevBright = wWorld.SkyBright;
}
}
-
-//0.069f, 0.086f, 0.107f, 0.134f,
View
7 blocks/Light.cpp
@@ -205,7 +205,8 @@ void Light::BlockLight(World& wWorld, Chunk& chunk, int side, BlockInChunk cx, B
if ((side == FRONT)||(side == BACK)) res *= 0.85f;
if ((side == RIGHT)||(side == LEFT)) res *= 0.90f;
- res = res - wWorld.SkyBright;
+ //res = res - wWorld.SkyBright;
+ res = res * ( 1.0 - wWorld.SkyBright);
glColor3f(res, res, res);
}
}
@@ -274,7 +275,9 @@ void Light::SoftLight(World& wWorld, BlockInWorld X, BlockInWorld Y, BlockInWorl
}
if ((side == FRONT)||(side == BACK)) res *= 0.85f;
if ((side == RIGHT)||(side == LEFT)) res *= 0.90f;
- res = res - wWorld.SkyBright;
+
+ res = res * ( 1.0 - wWorld.SkyBright);
+ //res = res - wWorld.SkyBright;
glColor3f(res, res, res);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.