mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-17 22:08:27 +02:00
Merge pull request #11242 from SamGondelman/tabletLayer2
Web overlays and entities are always non anti-aliased
This commit is contained in:
commit
a98d861600
7 changed files with 15 additions and 62 deletions
|
@ -26,8 +26,7 @@ Base3DOverlay::Base3DOverlay() :
|
|||
_isSolid(DEFAULT_IS_SOLID),
|
||||
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
||||
_ignoreRayIntersection(false),
|
||||
_drawInFront(false),
|
||||
_isAA(true)
|
||||
_drawInFront(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +38,6 @@ Base3DOverlay::Base3DOverlay(const Base3DOverlay* base3DOverlay) :
|
|||
_isDashedLine(base3DOverlay->_isDashedLine),
|
||||
_ignoreRayIntersection(base3DOverlay->_ignoreRayIntersection),
|
||||
_drawInFront(base3DOverlay->_drawInFront),
|
||||
_isAA(base3DOverlay->_isAA),
|
||||
_isGrabbable(base3DOverlay->_isGrabbable)
|
||||
{
|
||||
setTransform(base3DOverlay->getTransform());
|
||||
|
@ -191,13 +189,6 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
|||
needRenderItemUpdate = true;
|
||||
}
|
||||
|
||||
auto isAA = properties["isAA"];
|
||||
if (isAA.isValid()) {
|
||||
bool value = isAA.toBool();
|
||||
setIsAA(value);
|
||||
needRenderItemUpdate = true;
|
||||
}
|
||||
|
||||
// Communicate changes to the renderItem if needed
|
||||
if (needRenderItemUpdate) {
|
||||
auto itemID = getRenderItemID();
|
||||
|
@ -253,9 +244,6 @@ QVariant Base3DOverlay::getProperty(const QString& property) {
|
|||
if (property == "parentJointIndex") {
|
||||
return getParentJointIndex();
|
||||
}
|
||||
if (property == "isAA") {
|
||||
return _isAA;
|
||||
}
|
||||
|
||||
return Overlay::getProperty(property);
|
||||
}
|
||||
|
|
|
@ -43,14 +43,11 @@ public:
|
|||
bool getDrawInFront() const { return _drawInFront; }
|
||||
bool getIsGrabbable() const { return _isGrabbable; }
|
||||
|
||||
virtual bool isAA() const { return _isAA; }
|
||||
|
||||
void setLineWidth(float lineWidth) { _lineWidth = lineWidth; }
|
||||
void setIsSolid(bool isSolid) { _isSolid = isSolid; }
|
||||
void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; }
|
||||
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
||||
void setDrawInFront(bool value) { _drawInFront = value; }
|
||||
void setIsAA(bool value) { _isAA = value; }
|
||||
void setIsGrabbable(bool value) { _isGrabbable = value; }
|
||||
|
||||
virtual AABox getBounds() const override = 0;
|
||||
|
@ -75,7 +72,6 @@ protected:
|
|||
bool _isDashedLine;
|
||||
bool _ignoreRayIntersection;
|
||||
bool _drawInFront;
|
||||
bool _isAA;
|
||||
bool _isGrabbable { false };
|
||||
|
||||
QString _name;
|
||||
|
|
|
@ -335,9 +335,9 @@ void Web3DOverlay::render(RenderArgs* args) {
|
|||
batch.setModelTransform(transform);
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
if (color.a < OPAQUE_ALPHA_THRESHOLD) {
|
||||
geometryCache->bindTransparentWebBrowserProgram(batch, _isAA);
|
||||
geometryCache->bindWebBrowserProgram(batch, true);
|
||||
} else {
|
||||
geometryCache->bindOpaqueWebBrowserProgram(batch, _isAA);
|
||||
geometryCache->bindWebBrowserProgram(batch);
|
||||
}
|
||||
geometryCache->renderQuad(batch, halfSize * -1.0f, halfSize, vec2(0), vec2(1), color, _geometryId);
|
||||
batch.setResourceTexture(0, nullptr); // restore default white color after me
|
||||
|
|
|
@ -182,11 +182,10 @@ void WebEntityRenderer::doRender(RenderArgs* args) {
|
|||
float fadeRatio = _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) : 1.0f;
|
||||
batch._glColor4f(1.0f, 1.0f, 1.0f, fadeRatio);
|
||||
|
||||
const bool IS_AA = true;
|
||||
if (fadeRatio < OPAQUE_ALPHA_THRESHOLD) {
|
||||
DependencyManager::get<GeometryCache>()->bindTransparentWebBrowserProgram(batch, IS_AA);
|
||||
DependencyManager::get<GeometryCache>()->bindWebBrowserProgram(batch, true);
|
||||
} else {
|
||||
DependencyManager::get<GeometryCache>()->bindOpaqueWebBrowserProgram(batch, IS_AA);
|
||||
DependencyManager::get<GeometryCache>()->bindWebBrowserProgram(batch);
|
||||
}
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texMin, texMax, glm::vec4(1.0f, 1.0f, 1.0f, fadeRatio), _geometryId);
|
||||
}
|
||||
|
|
|
@ -1923,7 +1923,7 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) {
|
|||
return a.getRaw() == b.getRaw();
|
||||
}
|
||||
|
||||
static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable, bool isAA,
|
||||
static void buildWebShader(const std::string& vertShaderText, const std::string& fragShaderText, bool blendEnable,
|
||||
gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) {
|
||||
auto VS = gpu::Shader::createVertex(vertShaderText);
|
||||
auto PS = gpu::Shader::createPixel(fragShaderText);
|
||||
|
@ -1939,43 +1939,23 @@ static void buildWebShader(const std::string& vertShaderText, const std::string&
|
|||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
|
||||
if (isAA) {
|
||||
blendEnable ? PrepareStencil::testMask(*state) : PrepareStencil::testMaskDrawShape(*state);
|
||||
} else {
|
||||
PrepareStencil::testMaskDrawShapeNoAA(*state);
|
||||
}
|
||||
PrepareStencil::testMaskDrawShapeNoAA(*state);
|
||||
|
||||
pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state);
|
||||
}
|
||||
|
||||
void GeometryCache::bindOpaqueWebBrowserProgram(gpu::Batch& batch, bool isAA) {
|
||||
batch.setPipeline(getOpaqueWebBrowserProgram(isAA));
|
||||
void GeometryCache::bindWebBrowserProgram(gpu::Batch& batch, bool transparent) {
|
||||
batch.setPipeline(getWebBrowserProgram(transparent));
|
||||
}
|
||||
|
||||
gpu::PipelinePointer GeometryCache::getOpaqueWebBrowserProgram(bool isAA) {
|
||||
gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&]() {
|
||||
const bool BLEND_ENABLE = false;
|
||||
buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, true, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline);
|
||||
buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA);
|
||||
buildWebShader(simple_vert, simple_opaque_web_browser_frag, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA);
|
||||
buildWebShader(simple_vert, simple_transparent_web_browser_frag, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA);
|
||||
});
|
||||
|
||||
return isAA ? _simpleOpaqueWebBrowserPipeline : _simpleOpaqueWebBrowserPipelineNoAA;
|
||||
}
|
||||
|
||||
void GeometryCache::bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA) {
|
||||
batch.setPipeline(getTransparentWebBrowserProgram(isAA));
|
||||
}
|
||||
|
||||
gpu::PipelinePointer GeometryCache::getTransparentWebBrowserProgram(bool isAA) {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&]() {
|
||||
const bool BLEND_ENABLE = true;
|
||||
buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipeline);
|
||||
buildWebShader(simple_vert, simple_transparent_web_browser_frag, BLEND_ENABLE, false, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA);
|
||||
});
|
||||
|
||||
return isAA ? _simpleTransparentWebBrowserPipeline : _simpleTransparentWebBrowserPipelineNoAA;
|
||||
return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _simpleOpaqueWebBrowserPipelineNoAA;
|
||||
}
|
||||
|
||||
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) {
|
||||
|
|
|
@ -166,11 +166,8 @@ public:
|
|||
static gpu::PipelinePointer getSimplePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
bool unlit = false, bool depthBias = false, bool fading = false);
|
||||
|
||||
void bindOpaqueWebBrowserProgram(gpu::Batch& batch, bool isAA);
|
||||
gpu::PipelinePointer getOpaqueWebBrowserProgram(bool isAA);
|
||||
|
||||
void bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA);
|
||||
gpu::PipelinePointer getTransparentWebBrowserProgram(bool isAA);
|
||||
void bindWebBrowserProgram(gpu::Batch& batch, bool transparent = false);
|
||||
gpu::PipelinePointer getWebBrowserProgram(bool transparent);
|
||||
|
||||
static void initializeShapePipelines();
|
||||
|
||||
|
@ -459,10 +456,8 @@ private:
|
|||
static QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
|
||||
|
||||
gpu::ShaderPointer _simpleOpaqueWebBrowserShader;
|
||||
gpu::PipelinePointer _simpleOpaqueWebBrowserPipeline;
|
||||
gpu::PipelinePointer _simpleOpaqueWebBrowserPipelineNoAA;
|
||||
gpu::ShaderPointer _simpleTransparentWebBrowserShader;
|
||||
gpu::PipelinePointer _simpleTransparentWebBrowserPipeline;
|
||||
gpu::PipelinePointer _simpleTransparentWebBrowserPipelineNoAA;
|
||||
|
||||
static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||
|
|
|
@ -167,7 +167,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
|
|||
parentID: this.tabletEntityID,
|
||||
parentJointIndex: -1,
|
||||
showKeyboardFocusHighlight: false,
|
||||
isAA: HMD.active,
|
||||
visible: visible
|
||||
});
|
||||
|
||||
|
@ -453,10 +452,6 @@ WebTablet.prototype.onHmdChanged = function () {
|
|||
this.calculateTabletAttachmentProperties(NO_HANDS, false, tabletProperties);
|
||||
// TODO -- is this still needed?
|
||||
// Entities.editEntity(this.tabletEntityID, tabletProperties);
|
||||
|
||||
// Full scene FXAA should be disabled on the overlay when the tablet in desktop mode.
|
||||
// This should make the text more readable.
|
||||
Overlays.editOverlay(this.webOverlayID, { isAA: HMD.active });
|
||||
};
|
||||
|
||||
WebTablet.prototype.pickle = function () {
|
||||
|
|
Loading…
Reference in a new issue