mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-24 12:16:57 +02:00
Trying to see what s going on
This commit is contained in:
parent
668378481b
commit
6d4744ed47
3 changed files with 56 additions and 7 deletions
|
@ -15,7 +15,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <PerfStat.h>
|
||||
#include <ViewFrustum.h>
|
||||
#include <RenderArgs.h>
|
||||
|
||||
#include <gpu/Context.h>
|
||||
|
@ -50,6 +49,15 @@ const gpu::PipelinePointer DrawSceneOctree::getDrawCellBoundsPipeline() {
|
|||
return _drawCellBoundsPipeline;
|
||||
}
|
||||
|
||||
|
||||
void DrawSceneOctree::configure(const Config& config) {
|
||||
_showVisibleCells = config.showVisibleCells;
|
||||
|
||||
_justFrozeFrustum = (config.freezeFrustum && !_freezeFrustum);
|
||||
_freezeFrustum = config.freezeFrustum;
|
||||
}
|
||||
|
||||
|
||||
void DrawSceneOctree::run(const SceneContextPointer& sceneContext,
|
||||
const RenderContextPointer& renderContext) {
|
||||
assert(renderContext->args);
|
||||
|
@ -80,9 +88,18 @@ void DrawSceneOctree::run(const SceneContextPointer& sceneContext,
|
|||
return;
|
||||
}
|
||||
|
||||
auto queryFrustum = *args->_viewFrustum;
|
||||
if (_freezeFrustum) {
|
||||
if (_justFrozeFrustum) {
|
||||
_justFrozeFrustum = false;
|
||||
_frozenFrutstum = *args->_viewFrustum;
|
||||
}
|
||||
queryFrustum = _frozenFrutstum;
|
||||
}
|
||||
|
||||
// Try that:
|
||||
render::ItemIDs items;
|
||||
scene->getSpatialTree().select(items, *args->_viewFrustum);
|
||||
render::ItemIDs itemsCell;
|
||||
scene->getSpatialTree().select(itemsCell, queryFrustum);
|
||||
|
||||
|
||||
// Allright, something to render let's do it
|
||||
|
@ -100,14 +117,19 @@ void DrawSceneOctree::run(const SceneContextPointer& sceneContext,
|
|||
// bind the one gpu::Pipeline we need
|
||||
batch.setPipeline(getDrawCellBoundsPipeline());
|
||||
|
||||
const auto& inCells = scene->getSpatialTree()._cells;
|
||||
/* const auto& inCells = scene->getSpatialTree()._cells;
|
||||
|
||||
for (const auto& cell: inCells ) {
|
||||
*/
|
||||
|
||||
for (const auto& cellID : itemsCell) {
|
||||
auto cell = scene->getSpatialTree().getConcreteCell(cellID);
|
||||
|
||||
auto cellLoc = cell.getlocation();
|
||||
|
||||
glm::ivec4 cellLocation(cellLoc.pos.x, cellLoc.pos.y, cellLoc.pos.z, cellLoc.depth);
|
||||
if (cell.isBrickEmpty() || !cell.hasBrick()) {
|
||||
cellLocation.w *= -1;
|
||||
// cellLocation.w *= -1;
|
||||
}
|
||||
|
||||
batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
|
||||
|
|
|
@ -14,19 +14,46 @@
|
|||
|
||||
#include "DrawTask.h"
|
||||
#include "gpu/Batch.h"
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
namespace render {
|
||||
class DrawSceneOctreeConfig : public Job::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool showVisibleCells MEMBER showVisibleCells WRITE setShowVisibleCells)
|
||||
Q_PROPERTY(bool freezeFrustum MEMBER freezeFrustum WRITE setFreezeFrustum)
|
||||
public:
|
||||
DrawSceneOctreeConfig() : Job::Config(true) {} // FIXME FOR debug
|
||||
|
||||
bool showVisibleCells{ true }; // FIXME FOR debug
|
||||
bool freezeFrustum{ false };
|
||||
|
||||
public slots:
|
||||
void setShowVisibleCells(bool enabled) { showVisibleCells = enabled; dirty(); }
|
||||
void setFreezeFrustum(bool enabled) { freezeFrustum = enabled; dirty(); }
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
};
|
||||
|
||||
class DrawSceneOctree {
|
||||
|
||||
int _drawCellLocationLoc;
|
||||
gpu::PipelinePointer _drawCellBoundsPipeline;
|
||||
gpu::BufferPointer _cells;
|
||||
|
||||
|
||||
bool _showVisibleCells; // initialized by Config
|
||||
bool _freezeFrustum{ false }; // initialized by Config
|
||||
bool _justFrozeFrustum{ false };
|
||||
ViewFrustum _frozenFrutstum;
|
||||
|
||||
public:
|
||||
using JobModel = Job::Model<DrawSceneOctree>;
|
||||
using Config = DrawSceneOctreeConfig;
|
||||
using JobModel = Job::Model<DrawSceneOctree, Config>;
|
||||
|
||||
DrawSceneOctree() {}
|
||||
|
||||
void configure(const Config& config);
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext);
|
||||
|
||||
const gpu::PipelinePointer getDrawCellBoundsPipeline();
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace render {
|
|||
Q_PROPERTY(bool showDisplay MEMBER showDisplay WRITE setShowDisplay)
|
||||
Q_PROPERTY(bool showNetwork MEMBER showNetwork WRITE setShowNetwork)
|
||||
public:
|
||||
DrawStatusConfig() : Job::Config(true) {} // FIXME FOR debug
|
||||
DrawStatusConfig() : Job::Config(false) {} // FIXME FOR debug
|
||||
|
||||
void dirtyHelper();
|
||||
|
||||
|
|
Loading…
Reference in a new issue