mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into black
This commit is contained in:
commit
7d8356686c
8 changed files with 36 additions and 74 deletions
|
@ -26,8 +26,7 @@ Base3DOverlay::Base3DOverlay() :
|
||||||
_isSolid(DEFAULT_IS_SOLID),
|
_isSolid(DEFAULT_IS_SOLID),
|
||||||
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
||||||
_ignoreRayIntersection(false),
|
_ignoreRayIntersection(false),
|
||||||
_drawInFront(false),
|
_drawInFront(false)
|
||||||
_isAA(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +38,6 @@ Base3DOverlay::Base3DOverlay(const Base3DOverlay* base3DOverlay) :
|
||||||
_isDashedLine(base3DOverlay->_isDashedLine),
|
_isDashedLine(base3DOverlay->_isDashedLine),
|
||||||
_ignoreRayIntersection(base3DOverlay->_ignoreRayIntersection),
|
_ignoreRayIntersection(base3DOverlay->_ignoreRayIntersection),
|
||||||
_drawInFront(base3DOverlay->_drawInFront),
|
_drawInFront(base3DOverlay->_drawInFront),
|
||||||
_isAA(base3DOverlay->_isAA),
|
|
||||||
_isGrabbable(base3DOverlay->_isGrabbable)
|
_isGrabbable(base3DOverlay->_isGrabbable)
|
||||||
{
|
{
|
||||||
setTransform(base3DOverlay->getTransform());
|
setTransform(base3DOverlay->getTransform());
|
||||||
|
@ -191,13 +189,6 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
||||||
needRenderItemUpdate = true;
|
needRenderItemUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto isAA = properties["isAA"];
|
|
||||||
if (isAA.isValid()) {
|
|
||||||
bool value = isAA.toBool();
|
|
||||||
setIsAA(value);
|
|
||||||
needRenderItemUpdate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Communicate changes to the renderItem if needed
|
// Communicate changes to the renderItem if needed
|
||||||
if (needRenderItemUpdate) {
|
if (needRenderItemUpdate) {
|
||||||
auto itemID = getRenderItemID();
|
auto itemID = getRenderItemID();
|
||||||
|
@ -253,9 +244,6 @@ QVariant Base3DOverlay::getProperty(const QString& property) {
|
||||||
if (property == "parentJointIndex") {
|
if (property == "parentJointIndex") {
|
||||||
return getParentJointIndex();
|
return getParentJointIndex();
|
||||||
}
|
}
|
||||||
if (property == "isAA") {
|
|
||||||
return _isAA;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Overlay::getProperty(property);
|
return Overlay::getProperty(property);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,14 +43,11 @@ public:
|
||||||
bool getDrawInFront() const { return _drawInFront; }
|
bool getDrawInFront() const { return _drawInFront; }
|
||||||
bool getIsGrabbable() const { return _isGrabbable; }
|
bool getIsGrabbable() const { return _isGrabbable; }
|
||||||
|
|
||||||
virtual bool isAA() const { return _isAA; }
|
|
||||||
|
|
||||||
void setLineWidth(float lineWidth) { _lineWidth = lineWidth; }
|
void setLineWidth(float lineWidth) { _lineWidth = lineWidth; }
|
||||||
void setIsSolid(bool isSolid) { _isSolid = isSolid; }
|
void setIsSolid(bool isSolid) { _isSolid = isSolid; }
|
||||||
void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; }
|
void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; }
|
||||||
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
||||||
void setDrawInFront(bool value) { _drawInFront = value; }
|
void setDrawInFront(bool value) { _drawInFront = value; }
|
||||||
void setIsAA(bool value) { _isAA = value; }
|
|
||||||
void setIsGrabbable(bool value) { _isGrabbable = value; }
|
void setIsGrabbable(bool value) { _isGrabbable = value; }
|
||||||
|
|
||||||
virtual AABox getBounds() const override = 0;
|
virtual AABox getBounds() const override = 0;
|
||||||
|
@ -75,7 +72,6 @@ protected:
|
||||||
bool _isDashedLine;
|
bool _isDashedLine;
|
||||||
bool _ignoreRayIntersection;
|
bool _ignoreRayIntersection;
|
||||||
bool _drawInFront;
|
bool _drawInFront;
|
||||||
bool _isAA;
|
|
||||||
bool _isGrabbable { false };
|
bool _isGrabbable { false };
|
||||||
|
|
||||||
QString _name;
|
QString _name;
|
||||||
|
|
|
@ -335,9 +335,9 @@ void Web3DOverlay::render(RenderArgs* args) {
|
||||||
batch.setModelTransform(transform);
|
batch.setModelTransform(transform);
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
if (color.a < OPAQUE_ALPHA_THRESHOLD) {
|
if (color.a < OPAQUE_ALPHA_THRESHOLD) {
|
||||||
geometryCache->bindTransparentWebBrowserProgram(batch, _isAA);
|
geometryCache->bindWebBrowserProgram(batch, true);
|
||||||
} else {
|
} else {
|
||||||
geometryCache->bindOpaqueWebBrowserProgram(batch, _isAA);
|
geometryCache->bindWebBrowserProgram(batch);
|
||||||
}
|
}
|
||||||
geometryCache->renderQuad(batch, halfSize * -1.0f, halfSize, vec2(0), vec2(1), color, _geometryId);
|
geometryCache->renderQuad(batch, halfSize * -1.0f, halfSize, vec2(0), vec2(1), color, _geometryId);
|
||||||
batch.setResourceTexture(0, nullptr); // restore default white color after me
|
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;
|
float fadeRatio = _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) : 1.0f;
|
||||||
batch._glColor4f(1.0f, 1.0f, 1.0f, fadeRatio);
|
batch._glColor4f(1.0f, 1.0f, 1.0f, fadeRatio);
|
||||||
|
|
||||||
const bool IS_AA = true;
|
|
||||||
if (fadeRatio < OPAQUE_ALPHA_THRESHOLD) {
|
if (fadeRatio < OPAQUE_ALPHA_THRESHOLD) {
|
||||||
DependencyManager::get<GeometryCache>()->bindTransparentWebBrowserProgram(batch, IS_AA);
|
DependencyManager::get<GeometryCache>()->bindWebBrowserProgram(batch, true);
|
||||||
} else {
|
} 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);
|
DependencyManager::get<GeometryCache>()->renderQuad(batch, topLeft, bottomRight, texMin, texMax, glm::vec4(1.0f, 1.0f, 1.0f, fadeRatio), _geometryId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,10 +132,13 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
||||||
if (args.bitstreamVersion < VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP) {
|
if (args.bitstreamVersion < VERSION_ENTITIES_ANIMATION_PROPERTIES_GROUP) {
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_SETTINGS, QString, setAnimationSettings);
|
||||||
} else {
|
} else {
|
||||||
|
int bytesFromAnimation;
|
||||||
|
withWriteLock([&] {
|
||||||
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
|
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
|
||||||
// will automatically read into the animation loop
|
// will automatically read into the animation loop
|
||||||
int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
propertyFlags, overwriteLocalData, animationPropertiesChanged);
|
propertyFlags, overwriteLocalData, animationPropertiesChanged);
|
||||||
|
});
|
||||||
|
|
||||||
bytesRead += bytesFromAnimation;
|
bytesRead += bytesFromAnimation;
|
||||||
dataAt += bytesFromAnimation;
|
dataAt += bytesFromAnimation;
|
||||||
|
@ -188,8 +191,10 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
||||||
APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL());
|
APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
|
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
|
||||||
|
|
||||||
|
withReadLock([&] {
|
||||||
_animationProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties,
|
_animationProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties,
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
});
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
||||||
|
|
||||||
|
@ -241,12 +246,14 @@ ShapeType ModelEntityItem::computeTrueShapeType() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setModelURL(const QString& url) {
|
void ModelEntityItem::setModelURL(const QString& url) {
|
||||||
|
withWriteLock([&] {
|
||||||
if (_modelURL != url) {
|
if (_modelURL != url) {
|
||||||
_modelURL = url;
|
_modelURL = url;
|
||||||
if (_shapeType == SHAPE_TYPE_STATIC_MESH) {
|
if (_shapeType == SHAPE_TYPE_STATIC_MESH) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
||||||
|
@ -261,7 +268,9 @@ void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationURL(const QString& url) {
|
void ModelEntityItem::setAnimationURL(const QString& url) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
|
withWriteLock([&] {
|
||||||
_animationProperties.setURL(url);
|
_animationProperties.setURL(url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationSettings(const QString& value) {
|
void ModelEntityItem::setAnimationSettings(const QString& value) {
|
||||||
|
|
|
@ -1923,7 +1923,7 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) {
|
||||||
return a.getRaw() == b.getRaw();
|
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) {
|
gpu::ShaderPointer& shaderPointerOut, gpu::PipelinePointer& pipelinePointerOut) {
|
||||||
auto VS = gpu::Shader::createVertex(vertShaderText);
|
auto VS = gpu::Shader::createVertex(vertShaderText);
|
||||||
auto PS = gpu::Shader::createPixel(fragShaderText);
|
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::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
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);
|
pipelinePointerOut = gpu::Pipeline::create(shaderPointerOut, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryCache::bindOpaqueWebBrowserProgram(gpu::Batch& batch, bool isAA) {
|
void GeometryCache::bindWebBrowserProgram(gpu::Batch& batch, bool transparent) {
|
||||||
batch.setPipeline(getOpaqueWebBrowserProgram(isAA));
|
batch.setPipeline(getWebBrowserProgram(transparent));
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::PipelinePointer GeometryCache::getOpaqueWebBrowserProgram(bool isAA) {
|
gpu::PipelinePointer GeometryCache::getWebBrowserProgram(bool transparent) {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&]() {
|
std::call_once(once, [&]() {
|
||||||
const bool BLEND_ENABLE = false;
|
buildWebShader(simple_vert, simple_opaque_web_browser_frag, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA);
|
||||||
buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, true, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipeline);
|
buildWebShader(simple_vert, simple_transparent_web_browser_frag, true, _simpleTransparentWebBrowserShader, _simpleTransparentWebBrowserPipelineNoAA);
|
||||||
buildWebShader(simple_vert, simple_opaque_web_browser_frag, BLEND_ENABLE, false, _simpleOpaqueWebBrowserShader, _simpleOpaqueWebBrowserPipelineNoAA);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return isAA ? _simpleOpaqueWebBrowserPipeline : _simpleOpaqueWebBrowserPipelineNoAA;
|
return transparent ? _simpleTransparentWebBrowserPipelineNoAA : _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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool transparent, bool culled, bool unlit, bool depthBiased) {
|
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,
|
static gpu::PipelinePointer getSimplePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
||||||
bool unlit = false, bool depthBias = false, bool fading = false);
|
bool unlit = false, bool depthBias = false, bool fading = false);
|
||||||
|
|
||||||
void bindOpaqueWebBrowserProgram(gpu::Batch& batch, bool isAA);
|
void bindWebBrowserProgram(gpu::Batch& batch, bool transparent = false);
|
||||||
gpu::PipelinePointer getOpaqueWebBrowserProgram(bool isAA);
|
gpu::PipelinePointer getWebBrowserProgram(bool transparent);
|
||||||
|
|
||||||
void bindTransparentWebBrowserProgram(gpu::Batch& batch, bool isAA);
|
|
||||||
gpu::PipelinePointer getTransparentWebBrowserProgram(bool isAA);
|
|
||||||
|
|
||||||
static void initializeShapePipelines();
|
static void initializeShapePipelines();
|
||||||
|
|
||||||
|
@ -459,10 +456,8 @@ private:
|
||||||
static QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
|
static QHash<SimpleProgramKey, gpu::PipelinePointer> _simplePrograms;
|
||||||
|
|
||||||
gpu::ShaderPointer _simpleOpaqueWebBrowserShader;
|
gpu::ShaderPointer _simpleOpaqueWebBrowserShader;
|
||||||
gpu::PipelinePointer _simpleOpaqueWebBrowserPipeline;
|
|
||||||
gpu::PipelinePointer _simpleOpaqueWebBrowserPipelineNoAA;
|
gpu::PipelinePointer _simpleOpaqueWebBrowserPipelineNoAA;
|
||||||
gpu::ShaderPointer _simpleTransparentWebBrowserShader;
|
gpu::ShaderPointer _simpleTransparentWebBrowserShader;
|
||||||
gpu::PipelinePointer _simpleTransparentWebBrowserPipeline;
|
|
||||||
gpu::PipelinePointer _simpleTransparentWebBrowserPipelineNoAA;
|
gpu::PipelinePointer _simpleTransparentWebBrowserPipelineNoAA;
|
||||||
|
|
||||||
static render::ShapePipelinePointer getShapePipeline(bool textured = false, bool transparent = false, bool culled = true,
|
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,
|
parentID: this.tabletEntityID,
|
||||||
parentJointIndex: -1,
|
parentJointIndex: -1,
|
||||||
showKeyboardFocusHighlight: false,
|
showKeyboardFocusHighlight: false,
|
||||||
isAA: HMD.active,
|
|
||||||
visible: visible
|
visible: visible
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -453,10 +452,6 @@ WebTablet.prototype.onHmdChanged = function () {
|
||||||
this.calculateTabletAttachmentProperties(NO_HANDS, false, tabletProperties);
|
this.calculateTabletAttachmentProperties(NO_HANDS, false, tabletProperties);
|
||||||
// TODO -- is this still needed?
|
// TODO -- is this still needed?
|
||||||
// Entities.editEntity(this.tabletEntityID, tabletProperties);
|
// 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 () {
|
WebTablet.prototype.pickle = function () {
|
||||||
|
|
Loading…
Reference in a new issue