Commit 4e327544 authored by Philip Trettner's avatar Philip Trettner
Browse files

Merge branch 'feature/fix-geometry-grass-sample' into 'master'

Fix compilation of geometry grass sample with latest glow

See merge request Glow/glow-samples!5
parents 5e904faa c7b11b5e
...@@ -306,7 +306,11 @@ void GeometryGrassSample::init() ...@@ -306,7 +306,11 @@ void GeometryGrassSample::init()
mGrassUBO = UniformBuffer::create(); mGrassUBO = UniformBuffer::create();
mGrassUBO->bind().setData(mGrassUBOData); mGrassUBO->bind().setData(mGrassUBOData);
mTrampleSSBOData.mowerPos = glm::vec2(0);
mTrampleSSBOData.mowerPosX = 0;
mTrampleSSBOData.mowerPosY = 0;
// mTrampleSSBOData.mowerPos = glm::vec2(0);
static auto constexpr mowerRange = .75f; static auto constexpr mowerRange = .75f;
mTrampleSSBOData.mowerRangeSquared = mowerRange * mowerRange; mTrampleSSBOData.mowerRangeSquared = mowerRange * mowerRange;
mTrampleSSBO = ShaderStorageBuffer::create(); mTrampleSSBO = ShaderStorageBuffer::create();
...@@ -381,8 +385,9 @@ void GeometryGrassSample::onRenderOpaquePass(glow::pipeline::RenderContext const ...@@ -381,8 +385,9 @@ void GeometryGrassSample::onRenderOpaquePass(glow::pipeline::RenderContext const
{ {
// UBO + SSBO Update // UBO + SSBO Update
{ {
mTrampleSSBOData.mowerPos = mMowerPosition; mTrampleSSBOData.mowerPosX = mMowerPosition.x;
mTrampleSSBO->bind().setData(mTrampleSSBOData); mTrampleSSBOData.mowerPosY = mMowerPosition.y;
mTrampleSSBO->bind().setData(mTrampleSSBOData, GL_STREAM_DRAW);
applyConfigToUBO(); applyConfigToUBO();
mGrassUBOData.cameraUp = getCamera()->handle.getTransform().getUpVector(); mGrassUBOData.cameraUp = getCamera()->handle.getTransform().getUpVector();
...@@ -390,7 +395,7 @@ void GeometryGrassSample::onRenderOpaquePass(glow::pipeline::RenderContext const ...@@ -390,7 +395,7 @@ void GeometryGrassSample::onRenderOpaquePass(glow::pipeline::RenderContext const
mGrassUBOData.cleanVp = info.camData.cleanVp; mGrassUBOData.cleanVp = info.camData.cleanVp;
mGrassUBOData.prevCleanVp = info.camData.prevCleanVp; mGrassUBOData.prevCleanVp = info.camData.prevCleanVp;
mGrassUBOData.runtime = getCurrentTime(); mGrassUBOData.runtime = getCurrentTime();
mGrassUBO->bind().setData(mGrassUBOData); mGrassUBO->bind().setData(mGrassUBOData, GL_STREAM_DRAW);
} }
// Trampling and mowing // Trampling and mowing
......
...@@ -39,15 +39,17 @@ struct GrassUBOData ...@@ -39,15 +39,17 @@ struct GrassUBOData
struct Trampler struct Trampler
{ {
glow::std140vec2 pos; glm::vec2 pos;
glow::std140vec2 velocity; glm::vec2 velocity;
}; };
struct TrampleSSBOData struct TrampleSSBOData
{ {
glow::std140vec2 mowerPos; float mowerPosX;
glow::std140float mowerRangeSquared = 1.f; float mowerPosY;
std::vector<Trampler> tramplers; // glm::vec2 mowerPos;
float mowerRangeSquared = 1.f;
// std::vector<Trampler> tramplers;
}; };
} }
......
...@@ -15,7 +15,7 @@ layout(std430) buffer sTrampleInfo ...@@ -15,7 +15,7 @@ layout(std430) buffer sTrampleInfo
vec2 mowerPosition; vec2 mowerPosition;
float mowerRange2; float mowerRange2;
Trampler tramplers[]; //Trampler tramplers[];
} ssboTrampleInfo; } ssboTrampleInfo;
void main() void main()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment