First cut of Web3DOverlays without FXAA applied.

This commit is contained in:
Anthony J. Thibault 2017-01-27 18:03:18 -08:00
parent 116eef0a78
commit a9b478888c
6 changed files with 52 additions and 2 deletions

View file

@ -36,6 +36,8 @@ public:
bool getIgnoreRayIntersection() const { return _ignoreRayIntersection; }
bool getDrawInFront() const { return _drawInFront; }
virtual bool isAA() const { return true; }
void setLineWidth(float lineWidth) { _lineWidth = lineWidth; }
void setIsSolid(bool isSolid) { _isSolid = isSolid; }
void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; }

View file

@ -38,6 +38,9 @@ namespace render {
if (std::static_pointer_cast<Base3DOverlay>(overlay)->getDrawInFront()) {
builder.withLayered();
}
if (!std::static_pointer_cast<Base3DOverlay>(overlay)->isAA()) {
builder.withLayered();
}
if (overlay->getAlphaPulse() != 0.0f || overlay->getAlpha() != 1.0f) {
builder.withTransparent();
}
@ -51,11 +54,17 @@ namespace render {
}
template <> int payloadGetLayer(const Overlay::Pointer& overlay) {
// MAgic number while we are defining the layering mechanism:
const int LAYER_2D = 2;
const int LAYER_NO_AA = 3;
const int LAYER_2D = 2;
const int LAYER_3D_FRONT = 1;
const int LAYER_3D = 0;
if (overlay->is3D()) {
return (std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getDrawInFront() ? LAYER_3D_FRONT : LAYER_3D);
auto overlay3D = std::dynamic_pointer_cast<Base3DOverlay>(overlay);
if (overlay3D->isAA())
return (overlay3D->getDrawInFront() ? LAYER_3D_FRONT : LAYER_3D);
else
return LAYER_NO_AA;
} else {
return LAYER_2D;
}

View file

@ -29,6 +29,8 @@ public:
Web3DOverlay(const Web3DOverlay* Web3DOverlay);
virtual ~Web3DOverlay();
virtual bool isAA() const { return false; }
QString pickURL();
void loadSourceURL();
virtual void render(RenderArgs* args) override;

View file

@ -63,6 +63,10 @@ RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
const auto background = items[RenderFetchCullSortTask::BACKGROUND];
const auto spatialSelection = items[RenderFetchCullSortTask::SPATIAL_SELECTION];
// Filter the non antialiaased overlays
const int LAYER_NO_AA = 3;
const auto nonAAOverlays = addJob<FilterItemLayer>("Filter2DWebOverlays", overlayOpaques, LAYER_NO_AA);
// Prepare deferred, generate the shared Deferred Frame Transform
const auto deferredFrameTransform = addJob<GenerateDeferredFrameTransform>("DeferredFrameTransform");
const auto lightingModel = addJob<MakeLightingModel>("LightingModel");
@ -195,6 +199,10 @@ RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
// AA job to be revisited
addJob<Antialiasing>("Antialiasing", primaryFramebuffer);
// Draw 2DWeb non AA
const auto nonAAOverlaysInputs = DrawOverlay3D::Inputs(nonAAOverlays, lightingModel).hasVarying();
addJob<DrawOverlay3D>("Draw2DWebSurfaces", nonAAOverlaysInputs, false);
addJob<EndGPURangeTimer>("ToneAndPostRangeTimer", toneAndPostRangeTimer);
// Blit!

View file

@ -306,3 +306,19 @@ void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const Re
std::static_pointer_cast<Config>(renderContext->jobConfig)->numItems = (int)outItems.size();
}
void FilterItemLayer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
auto& scene = sceneContext->_scene;
// Clear previous values
outItems.clear();
// For each item, filter it into one bucket
for (auto itemBound : inItems) {
auto& item = scene->getItem(itemBound.id);
if (item.getLayer() == _keepLayer) {
outItems.emplace_back(itemBound);
}
}
}

View file

@ -175,6 +175,19 @@ namespace render {
}
}
};
class FilterItemLayer {
public:
using JobModel = Job::ModelIO<FilterItemLayer, ItemBounds, ItemBounds>;
FilterItemLayer() {}
FilterItemLayer(int keepLayer) :
_keepLayer(keepLayer) {}
int _keepLayer { 0 };
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems);
};
}
#endif // hifi_render_CullTask_h;