diff options
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/entity.fs | 3 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/face.fs | 4 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/sky.fs | 8 | ||||
-rw-r--r-- | src/RendererWorld.cpp | 9 | ||||
-rw-r--r-- | src/World.cpp | 2 |
5 files changed, 19 insertions, 7 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/entity.fs b/cwd/assets/altcraft/shaders/frag/entity.fs index f0bb42f..6a11c96 100644 --- a/cwd/assets/altcraft/shaders/frag/entity.fs +++ b/cwd/assets/altcraft/shaders/frag/entity.fs @@ -2,8 +2,9 @@ uniform vec3 color; in vec2 uvPos; +out vec4 fragColor; void main(){ //if (uvPos.x < 0.9 && uvPos.x > 0.1 && uvPos.y < 0.9 && uvPos.y > 0.1) discard; - gl_FragColor = vec4(color,1); + fragColor = vec4(color,1); }
\ No newline at end of file diff --git a/cwd/assets/altcraft/shaders/frag/face.fs b/cwd/assets/altcraft/shaders/frag/face.fs index 98b389a..bd2a2d7 100644 --- a/cwd/assets/altcraft/shaders/frag/face.fs +++ b/cwd/assets/altcraft/shaders/frag/face.fs @@ -7,6 +7,8 @@ in VS_OUT { vec2 Light; } fs_in; +out vec4 fragColor; + uniform sampler2DArray textureAtlas; uniform float DayTime; uniform float MinLightLevel; @@ -44,5 +46,5 @@ void main() { float faceLight = clamp(light + skyLight,MinLightLevel,1.0); color = vec4(color.rgb * faceLight, color.a); - gl_FragColor = color; + fragColor = color; }
\ No newline at end of file diff --git a/cwd/assets/altcraft/shaders/frag/sky.fs b/cwd/assets/altcraft/shaders/frag/sky.fs index 36d65a5..2f51267 100644 --- a/cwd/assets/altcraft/shaders/frag/sky.fs +++ b/cwd/assets/altcraft/shaders/frag/sky.fs @@ -3,6 +3,8 @@ in vec2 uvPos; in vec3 pos; +out vec4 fragColor; + uniform sampler2DArray textureAtlas; uniform float DayTime; uniform vec4 sunTexture; @@ -45,7 +47,7 @@ vec4 Moon() { void main() { vec4 starColor = vec4(0.0f, 0.04f, 0.06f, 1.0f); - gl_FragColor = mix(starColor, DaySkyColor, DayTime); - gl_FragColor += Sun(); - gl_FragColor += Moon(); + fragColor = mix(starColor, DaySkyColor, DayTime); + fragColor += Sun(); + fragColor += Moon(); }
\ No newline at end of file diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index ebb049d..b433609 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -293,7 +293,9 @@ void RendererWorld::Render(RenderState & renderState) { glm::mat4 projView = projection * view; //Render Entities +#ifndef __APPLE__ glLineWidth(3.0); +#endif Shader *entityShader = AssetManager::GetAsset<AssetShader>("/altcraft/shaders/entity")->shader.get(); entityShader->Activate(); entityShader->SetUniform("projection", projection); @@ -308,7 +310,9 @@ void RendererWorld::Render(RenderState & renderState) { //Render selected block Vector selectedBlock = GetGameState()->GetSelectionStatus().selectedBlock; if (selectedBlock != Vector()) { +#ifndef __APPLE__ glLineWidth(2.0f); +#endif { glm::mat4 model = glm::mat4(1.0); model = glm::translate(model, selectedBlock.glm()); @@ -325,7 +329,9 @@ void RendererWorld::Render(RenderState & renderState) { const bool renderHit = false; if (renderHit) { VectorF hit = GetGameState()->GetSelectionStatus().raycastHit; +#ifndef __APPLE__ glLineWidth(2.0f); +#endif { glm::mat4 model; model = glm::translate(model, hit.glm()); @@ -339,8 +345,9 @@ void RendererWorld::Render(RenderState & renderState) { glDrawArrays(GL_LINE_STRIP, 0, 36); } } - +#ifndef __APPLE__ glLineWidth(1.0); +#endif glCheckError(); //Render sky diff --git a/src/World.cpp b/src/World.cpp index c3246dc..e5e3fe8 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -201,7 +201,7 @@ void World::UpdatePhysics(float delta) { BlockId block = this->GetBlockId(Vector(x, y, z)); if (block.id == 0 || !GetBlockInfo(block).collides) continue; - AABB blockColl{ x,y,z,1.0,1.0,1.0 }; + AABB blockColl{ (double)x,(double)y,(double)z,1.0,1.0,1.0 }; if (TestCollision(entityCollBox, blockColl)) { return { true }; } |