diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-09 23:29:00 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-09 23:29:00 +0100 |
commit | b6b3944e9507f337f77a72ea44b5c0ccba7a2c01 (patch) | |
tree | a487df54853522f973ed987006e787117804b9eb /gfx/gl | |
parent | Swap messy glmvec wrapper for OpenMesh Point/Normal with real glm::vec and a ... (diff) | |
parent | Move remaining split/plane functions to use library (diff) | |
download | ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.tar.bz2 ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.tar.xz ilt-b6b3944e9507f337f77a72ea44b5c0ccba7a2c01.zip |
Merge branch 'model-factory-textures'
Diffstat (limited to 'gfx/gl')
-rw-r--r-- | gfx/gl/camera.cpp | 4 | ||||
-rw-r--r-- | gfx/gl/camera.h | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/basicShader.fs | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp index b596c43..5b7269e 100644 --- a/gfx/gl/camera.cpp +++ b/gfx/gl/camera.cpp @@ -6,8 +6,8 @@ #include <ray.hpp> Camera::Camera(glm::vec3 pos, float fov, float aspect, float zNear, float zFar) : - position {pos}, forward {::north}, up {::up}, fov {fov}, aspect {aspect}, near {zNear}, far {zFar}, - projection {glm::perspective(fov, aspect, zNear, zFar)}, + position {pos}, forward {::north}, up {::up}, near {zNear}, far {zFar}, projection {glm::perspective( + fov, aspect, zNear, zFar)}, viewProjection {projection * glm::lookAt(position, position + forward, up)}, inverseViewProjection { glm::inverse(viewProjection)} { diff --git a/gfx/gl/camera.h b/gfx/gl/camera.h index 9685a7d..b5611f8 100644 --- a/gfx/gl/camera.h +++ b/gfx/gl/camera.h @@ -72,7 +72,7 @@ private: glm::vec3 forward;
glm::vec3 up;
- float fov, aspect, near, far;
+ float near, far;
glm::mat4 projection;
glm::mat4 viewProjection, inverseViewProjection;
};
diff --git a/gfx/gl/shaders/basicShader.fs b/gfx/gl/shaders/basicShader.fs index 93f0a3f..24b2791 100644 --- a/gfx/gl/shaders/basicShader.fs +++ b/gfx/gl/shaders/basicShader.fs @@ -14,8 +14,9 @@ uniform sampler2D texture0; void main() { - float clear = round(texture(texture0, TexCoords).a); + vec4 textureColour = texture(texture0, TexCoords); + float clear = round(mix(textureColour.a, 1, Colour.a)); gPosition = vec4(FragPos, clear); gNormal = vec4(Normal, clear); - gAlbedoSpec = mix(texture(texture0, TexCoords), vec4(Colour.rgb, 1), Colour.a); + gAlbedoSpec = mix(textureColour, vec4(Colour.rgb, 1), Colour.a); } |