diff options
-rw-r--r-- | gfx/gl/sceneShader.cpp | 7 | ||||
-rw-r--r-- | gfx/gl/sceneShader.h | 1 | ||||
-rw-r--r-- | gfx/gl/shaders/dynamicPointInst.vs | 21 |
3 files changed, 28 insertions, 1 deletions
diff --git a/gfx/gl/sceneShader.cpp b/gfx/gl/sceneShader.cpp index bcd0590..54f5737 100644 --- a/gfx/gl/sceneShader.cpp +++ b/gfx/gl/sceneShader.cpp @@ -8,6 +8,7 @@ #include <gfx/gl/shaders/gs-pointLight.h> #include <gfx/gl/shaders/gs-spotLight.h> #include <gfx/gl/shaders/vs-dynamicPoint.h> +#include <gfx/gl/shaders/vs-dynamicPointInst.h> #include <gfx/gl/shaders/vs-fixedPoint.h> #include <gfx/gl/shaders/vs-pointLight.h> #include <gfx/gl/shaders/vs-spotLight.h> @@ -18,7 +19,11 @@ #include <location.hpp> #include <maths.h> -SceneShader::SceneShader() : landmass {fixedPoint_vs, landmass_fs}, absolute {fixedPoint_vs, material_fs} { } +SceneShader::SceneShader() : + basicInst {dynamicPointInst_vs, material_fs}, landmass {fixedPoint_vs, landmass_fs}, absolute {fixedPoint_vs, + material_fs} +{ +} void SceneShader::setViewProjection(const glm::mat4 & viewProjection) const diff --git a/gfx/gl/sceneShader.h b/gfx/gl/sceneShader.h index ed1bb79..0ccf152 100644 --- a/gfx/gl/sceneShader.h +++ b/gfx/gl/sceneShader.h @@ -80,6 +80,7 @@ public: SceneShader(); BasicProgram basic; + SceneProgram basicInst; WaterProgram water; AbsolutePosProgram landmass, absolute; PointLightShader pointLight; diff --git a/gfx/gl/shaders/dynamicPointInst.vs b/gfx/gl/shaders/dynamicPointInst.vs new file mode 100644 index 0000000..016153a --- /dev/null +++ b/gfx/gl/shaders/dynamicPointInst.vs @@ -0,0 +1,21 @@ +#version 330 core + +include(`meshIn.glsl') +layout(location = 6) in mat4 model; +include(`materialInterface.glsl') + +uniform mat4 viewProjection; + +void +main() +{ + vec4 worldPos = model * vec4(position, 1.0); + + FragPos = worldPos.xyz; + TexCoords = texCoord; + Normal = (model * vec4(normal, 0.0)).xyz; + Colour = colour; + Material = material; + + gl_Position = viewProjection * worldPos; +} |