Skip to content

Commit

Permalink
Merge pull request #755 from vsg-dev/master
Browse files Browse the repository at this point in the history
Merge fixes from master.
  • Loading branch information
vsg-dev authored Mar 17, 2023
2 parents ba9e6f8 + 54cfb11 commit ee9391d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/vsg/state/ArrayState.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace vsg
void apply(const InputAssemblyState& ias) override;

void apply(const Geometry& geometry) override;
void apply(const VertexDraw& vid) override;
void apply(const VertexIndexDraw& vid) override;
void apply(const BindVertexBuffers& bvb) override;
void apply(const BufferInfo& bufferInfo) override;
Expand Down
1 change: 1 addition & 0 deletions include/vsg/utils/ComputeBounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace vsg
void apply(const Transform& transform) override;
void apply(const MatrixTransform& transform) override;
void apply(const Geometry& geometry) override;
void apply(const VertexDraw& vid) override;
void apply(const VertexIndexDraw& vid) override;
void apply(const BindVertexBuffers& bvb) override;
void apply(const BindIndexBuffer& bib) override;
Expand Down
1 change: 1 addition & 0 deletions include/vsg/utils/Intersector.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace vsg
void apply(const PagedLOD& plod) override;
void apply(const CullNode& cn) override;

void apply(const VertexDraw& vid) override;
void apply(const VertexIndexDraw& vid) override;
void apply(const Geometry& geometry) override;

Expand Down
6 changes: 6 additions & 0 deletions src/vsg/state/ArrayState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/io/Options.h>
#include <vsg/maths/sample.h>
#include <vsg/nodes/Geometry.h>
#include <vsg/nodes/VertexDraw.h>
#include <vsg/nodes/VertexIndexDraw.h>
#include <vsg/state/ArrayState.h>
#include <vsg/state/BindDescriptorSet.h>
Expand Down Expand Up @@ -80,6 +81,11 @@ void ArrayState::apply(const vsg::Geometry& geometry)
applyArrays(geometry.firstBinding, geometry.arrays);
}

void ArrayState::apply(const vsg::VertexDraw& vid)
{
applyArrays(vid.firstBinding, vid.arrays);
}

void ArrayState::apply(const vsg::VertexIndexDraw& vid)
{
applyArrays(vid.firstBinding, vid.arrays);
Expand Down
9 changes: 9 additions & 0 deletions src/vsg/utils/ComputeBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/nodes/Geometry.h>
#include <vsg/nodes/MatrixTransform.h>
#include <vsg/nodes/StateGroup.h>
#include <vsg/nodes/VertexDraw.h>
#include <vsg/nodes/VertexIndexDraw.h>
#include <vsg/text/Text.h>
#include <vsg/text/TextGroup.h>
Expand Down Expand Up @@ -91,6 +92,14 @@ void ComputeBounds::apply(const vsg::Geometry& geometry)
}
}

void ComputeBounds::apply(const vsg::VertexDraw& vid)
{
auto& arrayState = *arrayStateStack.back();
arrayState.apply(vid);

applyDraw(vid.firstVertex, vid.vertexCount, vid.firstInstance, vid.instanceCount);
}

void ComputeBounds::apply(const vsg::VertexIndexDraw& vid)
{
auto& arrayState = *arrayStateStack.back();
Expand Down
13 changes: 13 additions & 0 deletions src/vsg/utils/Intersector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/nodes/PagedLOD.h>
#include <vsg/nodes/StateGroup.h>
#include <vsg/nodes/Transform.h>
#include <vsg/nodes/VertexDraw.h>
#include <vsg/nodes/VertexIndexDraw.h>
#include <vsg/state/GraphicsPipeline.h>
#include <vsg/utils/Intersector.h>
Expand Down Expand Up @@ -120,6 +121,18 @@ void Intersector::apply(const CullNode& cn)
if (intersects(cn.bound)) cn.traverse(*this);
}

void Intersector::apply(const VertexDraw& vid)
{
auto& arrayState = *arrayStateStack.back();
arrayState.apply(vid);
if (!arrayState.vertices) return;


PushPopNode ppn(_nodePath, &vid);

intersectDraw(vid.firstVertex, vid.vertexCount, vid.firstInstance, vid.instanceCount);
}

void Intersector::apply(const VertexIndexDraw& vid)
{
auto& arrayState = *arrayStateStack.back();
Expand Down

0 comments on commit ee9391d

Please sign in to comment.