mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 12:18:36 +02:00
Merge pull request #7460 from hyperlogic/tony/skip-culling-render-config
CullTask: added ability to disable culling during rendering.
This commit is contained in:
commit
093f5d0019
2 changed files with 95 additions and 39 deletions
|
@ -114,6 +114,7 @@ void FetchSpatialTree::run(const SceneContextPointer& sceneContext, const Render
|
||||||
void CullSpatialSelection::configure(const Config& config) {
|
void CullSpatialSelection::configure(const Config& config) {
|
||||||
_justFrozeFrustum = _justFrozeFrustum || (config.freezeFrustum && !_freezeFrustum);
|
_justFrozeFrustum = _justFrozeFrustum || (config.freezeFrustum && !_freezeFrustum);
|
||||||
_freezeFrustum = config.freezeFrustum;
|
_freezeFrustum = config.freezeFrustum;
|
||||||
|
_skipCulling = config.skipCulling;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
||||||
|
@ -191,60 +192,112 @@ void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const Re
|
||||||
// visibility cull if partially selected ( octree cell contianing it was partial)
|
// visibility cull if partially selected ( octree cell contianing it was partial)
|
||||||
// distance cull if was a subcell item ( octree cell is way bigger than the item bound itself, so now need to test per item)
|
// distance cull if was a subcell item ( octree cell is way bigger than the item bound itself, so now need to test per item)
|
||||||
|
|
||||||
// inside & fit items: easy, just filter
|
if (_skipCulling) {
|
||||||
{
|
// inside & fit items: filter only, culling is disabled
|
||||||
PerformanceTimer perfTimer("insideFitItems");
|
{
|
||||||
for (auto id : inSelection.insideItems) {
|
PerformanceTimer perfTimer("insideFitItems");
|
||||||
auto& item = scene->getItem(id);
|
for (auto id : inSelection.insideItems) {
|
||||||
if (_filter.test(item.getKey())) {
|
auto& item = scene->getItem(id);
|
||||||
ItemBound itemBound(id, item.getBound());
|
if (_filter.test(item.getKey())) {
|
||||||
outItems.emplace_back(itemBound);
|
ItemBound itemBound(id, item.getBound());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// inside & subcell items: filter & distance cull
|
|
||||||
{
|
|
||||||
PerformanceTimer perfTimer("insideSmallItems");
|
|
||||||
for (auto id : inSelection.insideSubcellItems) {
|
|
||||||
auto& item = scene->getItem(id);
|
|
||||||
if (_filter.test(item.getKey())) {
|
|
||||||
ItemBound itemBound(id, item.getBound());
|
|
||||||
if (test.solidAngleTest(itemBound.bound)) {
|
|
||||||
outItems.emplace_back(itemBound);
|
outItems.emplace_back(itemBound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// partial & fit items: filter & frustum cull
|
// inside & subcell items: filter only, culling is disabled
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("partialFitItems");
|
PerformanceTimer perfTimer("insideSmallItems");
|
||||||
for (auto id : inSelection.partialItems) {
|
for (auto id : inSelection.insideSubcellItems) {
|
||||||
auto& item = scene->getItem(id);
|
auto& item = scene->getItem(id);
|
||||||
if (_filter.test(item.getKey())) {
|
if (_filter.test(item.getKey())) {
|
||||||
ItemBound itemBound(id, item.getBound());
|
ItemBound itemBound(id, item.getBound());
|
||||||
if (test.frustumTest(itemBound.bound)) {
|
|
||||||
outItems.emplace_back(itemBound);
|
outItems.emplace_back(itemBound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// partial & subcell items:: filter & frutum cull & solidangle cull
|
// partial & fit items: filter only, culling is disabled
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("partialSmallItems");
|
PerformanceTimer perfTimer("partialFitItems");
|
||||||
for (auto id : inSelection.partialSubcellItems) {
|
for (auto id : inSelection.partialItems) {
|
||||||
auto& item = scene->getItem(id);
|
auto& item = scene->getItem(id);
|
||||||
if (_filter.test(item.getKey())) {
|
if (_filter.test(item.getKey())) {
|
||||||
ItemBound itemBound(id, item.getBound());
|
ItemBound itemBound(id, item.getBound());
|
||||||
if (test.frustumTest(itemBound.bound)) {
|
outItems.emplace_back(itemBound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// partial & subcell items: filter only, culling is disabled
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("partialSmallItems");
|
||||||
|
for (auto id : inSelection.partialSubcellItems) {
|
||||||
|
auto& item = scene->getItem(id);
|
||||||
|
if (_filter.test(item.getKey())) {
|
||||||
|
ItemBound itemBound(id, item.getBound());
|
||||||
|
outItems.emplace_back(itemBound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// inside & fit items: easy, just filter
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("insideFitItems");
|
||||||
|
for (auto id : inSelection.insideItems) {
|
||||||
|
auto& item = scene->getItem(id);
|
||||||
|
if (_filter.test(item.getKey())) {
|
||||||
|
ItemBound itemBound(id, item.getBound());
|
||||||
|
outItems.emplace_back(itemBound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// inside & subcell items: filter & distance cull
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("insideSmallItems");
|
||||||
|
for (auto id : inSelection.insideSubcellItems) {
|
||||||
|
auto& item = scene->getItem(id);
|
||||||
|
if (_filter.test(item.getKey())) {
|
||||||
|
ItemBound itemBound(id, item.getBound());
|
||||||
if (test.solidAngleTest(itemBound.bound)) {
|
if (test.solidAngleTest(itemBound.bound)) {
|
||||||
outItems.emplace_back(itemBound);
|
outItems.emplace_back(itemBound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// partial & fit items: filter & frustum cull
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("partialFitItems");
|
||||||
|
for (auto id : inSelection.partialItems) {
|
||||||
|
auto& item = scene->getItem(id);
|
||||||
|
if (_filter.test(item.getKey())) {
|
||||||
|
ItemBound itemBound(id, item.getBound());
|
||||||
|
if (test.frustumTest(itemBound.bound)) {
|
||||||
|
outItems.emplace_back(itemBound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// partial & subcell items:: filter & frutum cull & solidangle cull
|
||||||
|
{
|
||||||
|
PerformanceTimer perfTimer("partialSmallItems");
|
||||||
|
for (auto id : inSelection.partialSubcellItems) {
|
||||||
|
auto& item = scene->getItem(id);
|
||||||
|
if (_filter.test(item.getKey())) {
|
||||||
|
ItemBound itemBound(id, item.getBound());
|
||||||
|
if (test.frustumTest(itemBound.bound)) {
|
||||||
|
if (test.solidAngleTest(itemBound.bound)) {
|
||||||
|
outItems.emplace_back(itemBound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
details._rendered += (int)outItems.size();
|
details._rendered += (int)outItems.size();
|
||||||
|
|
|
@ -70,14 +70,16 @@ namespace render {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int numItems READ getNumItems)
|
Q_PROPERTY(int numItems READ getNumItems)
|
||||||
Q_PROPERTY(bool freezeFrustum MEMBER freezeFrustum WRITE setFreezeFrustum)
|
Q_PROPERTY(bool freezeFrustum MEMBER freezeFrustum WRITE setFreezeFrustum)
|
||||||
|
Q_PROPERTY(bool skipCulling MEMBER skipCulling WRITE setSkipCulling)
|
||||||
public:
|
public:
|
||||||
int numItems{ 0 };
|
int numItems{ 0 };
|
||||||
int getNumItems() { return numItems; }
|
int getNumItems() { return numItems; }
|
||||||
|
|
||||||
bool freezeFrustum{ false };
|
bool freezeFrustum{ false };
|
||||||
|
bool skipCulling{ false };
|
||||||
public slots:
|
public slots:
|
||||||
void setFreezeFrustum(bool enabled) { freezeFrustum = enabled; emit dirty(); }
|
void setFreezeFrustum(bool enabled) { freezeFrustum = enabled; emit dirty(); }
|
||||||
|
void setSkipCulling(bool enabled) { skipCulling = enabled; emit dirty(); }
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
};
|
};
|
||||||
|
@ -85,6 +87,7 @@ namespace render {
|
||||||
class CullSpatialSelection {
|
class CullSpatialSelection {
|
||||||
bool _freezeFrustum{ false }; // initialized by Config
|
bool _freezeFrustum{ false }; // initialized by Config
|
||||||
bool _justFrozeFrustum{ false };
|
bool _justFrozeFrustum{ false };
|
||||||
|
bool _skipCulling{ false };
|
||||||
ViewFrustum _frozenFrutstum;
|
ViewFrustum _frozenFrutstum;
|
||||||
public:
|
public:
|
||||||
using Config = CullSpatialSelectionConfig;
|
using Config = CullSpatialSelectionConfig;
|
||||||
|
|
Loading…
Reference in a new issue