mirror of
https://github.com/lubosz/overte.git
synced 2025-04-18 04:18:17 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into notificationsForFourApps
This commit is contained in:
commit
e75a45af92
11 changed files with 120 additions and 79 deletions
|
@ -382,9 +382,8 @@ void ParabolaPointer::RenderState::ParabolaRenderItem::updateBounds() {
|
|||
|
||||
const gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::getParabolaPipeline() {
|
||||
if (!_parabolaPipeline || !_transparentParabolaPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola);
|
||||
|
||||
{
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola);
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setBlendFunction(false,
|
||||
|
@ -396,6 +395,7 @@ const gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::get
|
|||
}
|
||||
|
||||
{
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola_translucent);
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setBlendFunction(true,
|
||||
|
|
|
@ -1322,6 +1322,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
emit DependencyManager::get<scriptable::ModelProviderFactory>()->
|
||||
modelRemovedFromScene(entity->getEntityItemID(), NestableType::Entity, _model);
|
||||
}
|
||||
setKey(false);
|
||||
_didLastVisualGeometryRequestSucceed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1347,6 +1349,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
if (_parsedModelURL != model->getURL()) {
|
||||
withWriteLock([&] {
|
||||
_texturesLoaded = false;
|
||||
_jointMappingCompleted = false;
|
||||
model->setURL(_parsedModelURL);
|
||||
});
|
||||
}
|
||||
|
@ -1457,7 +1460,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
mapJoints(entity, model->getJointNames());
|
||||
//else the joint have been mapped before but we have a new animation to load
|
||||
} else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
|
||||
_jointMappingCompleted = false;
|
||||
mapJoints(entity, model->getJointNames());
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ private:
|
|||
const void* _collisionMeshKey { nullptr };
|
||||
|
||||
// used on client side
|
||||
bool _jointMappingCompleted{ false };
|
||||
bool _jointMappingCompleted { false };
|
||||
QVector<int> _jointMapping; // domain is index into model-joints, range is index into animation-joints
|
||||
AnimationPointer _animation;
|
||||
QUrl _parsedModelURL;
|
||||
|
|
|
@ -187,12 +187,10 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
particle.basePosition = baseTransform.getTranslation();
|
||||
|
||||
// Position, velocity, and acceleration
|
||||
glm::vec3 emitDirection;
|
||||
if (polarStart == 0.0f && polarFinish == 0.0f && emitDimensions.z == 0.0f) {
|
||||
// Emit along z-axis from position
|
||||
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * Vectors::UNIT_Z);
|
||||
particle.acceleration = emitAcceleration + randFloatInRange(-1.0f, 1.0f) * accelerationSpread;
|
||||
|
||||
emitDirection = Vectors::UNIT_Z;
|
||||
} else {
|
||||
// Emit around point or from ellipsoid
|
||||
// - Distribute directions evenly around point
|
||||
|
@ -210,7 +208,6 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
azimuth = azimuthStart + (TWO_PI + azimuthFinish - azimuthStart) * randFloat();
|
||||
}
|
||||
|
||||
glm::vec3 emitDirection;
|
||||
if (emitDimensions == Vectors::ZERO) {
|
||||
// Point
|
||||
emitDirection = glm::quat(glm::vec3(PI_OVER_TWO - elevation, 0.0f, azimuth)) * Vectors::UNIT_Z;
|
||||
|
@ -235,10 +232,10 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
));
|
||||
particle.relativePosition += emitOrientation * emitPosition;
|
||||
}
|
||||
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * emitDirection);
|
||||
particle.acceleration = emitAcceleration + randFloatInRange(-1.0f, 1.0f) * accelerationSpread;
|
||||
}
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * emitDirection);
|
||||
particle.acceleration = emitAcceleration +
|
||||
glm::vec3(randFloatInRange(-1.0f, 1.0f), randFloatInRange(-1.0f, 1.0f), randFloatInRange(-1.0f, 1.0f)) * accelerationSpread;
|
||||
|
||||
return particle;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,9 @@ EntityItemProperties ModelEntityItem::getProperties(EntityPropertyFlags desiredP
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslations, getJointTranslations);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(relayParentJoints, getRelayParentJoints);
|
||||
_animationProperties.getProperties(properties);
|
||||
withReadLock([&] {
|
||||
_animationProperties.getProperties(properties);
|
||||
});
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
@ -123,15 +125,18 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
|||
|
||||
// grab a local copy of _animationProperties to avoid multiple locks
|
||||
int bytesFromAnimation;
|
||||
AnimationPropertyGroup animationProperties;
|
||||
withReadLock([&] {
|
||||
AnimationPropertyGroup animationProperties = _animationProperties;
|
||||
animationProperties = _animationProperties;
|
||||
bytesFromAnimation = animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||
propertyFlags, overwriteLocalData, animationPropertiesChanged);
|
||||
if (animationPropertiesChanged) {
|
||||
applyNewAnimationProperties(animationProperties);
|
||||
somethingChanged = true;
|
||||
}
|
||||
});
|
||||
if (animationPropertiesChanged) {
|
||||
withWriteLock([&] {
|
||||
applyNewAnimationProperties(animationProperties);
|
||||
});
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
bytesRead += bytesFromAnimation;
|
||||
dataAt += bytesFromAnimation;
|
||||
|
@ -305,69 +310,77 @@ void ModelEntityItem::setAnimationURL(const QString& url) {
|
|||
void ModelEntityItem::setAnimationSettings(const QString& value) {
|
||||
// NOTE: this method only called for old bitstream format
|
||||
|
||||
AnimationPropertyGroup animationProperties;
|
||||
withReadLock([&] {
|
||||
animationProperties = _animationProperties;
|
||||
});
|
||||
|
||||
// the animations setting is a JSON string that may contain various animation settings.
|
||||
// if it includes fps, currentFrame, or running, those values will be parsed out and
|
||||
// will over ride the regular animation settings
|
||||
QJsonDocument settingsAsJson = QJsonDocument::fromJson(value.toUtf8());
|
||||
QJsonObject settingsAsJsonObject = settingsAsJson.object();
|
||||
QVariantMap settingsMap = settingsAsJsonObject.toVariantMap();
|
||||
if (settingsMap.contains("fps")) {
|
||||
float fps = settingsMap["fps"].toFloat();
|
||||
animationProperties.setFPS(fps);
|
||||
}
|
||||
|
||||
// old settings used frameIndex
|
||||
if (settingsMap.contains("frameIndex")) {
|
||||
float currentFrame = settingsMap["frameIndex"].toFloat();
|
||||
animationProperties.setCurrentFrame(currentFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("running")) {
|
||||
bool running = settingsMap["running"].toBool();
|
||||
if (running != animationProperties.getRunning()) {
|
||||
animationProperties.setRunning(running);
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsMap.contains("firstFrame")) {
|
||||
float firstFrame = settingsMap["firstFrame"].toFloat();
|
||||
animationProperties.setFirstFrame(firstFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("lastFrame")) {
|
||||
float lastFrame = settingsMap["lastFrame"].toFloat();
|
||||
animationProperties.setLastFrame(lastFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("loop")) {
|
||||
bool loop = settingsMap["loop"].toBool();
|
||||
animationProperties.setLoop(loop);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("hold")) {
|
||||
bool hold = settingsMap["hold"].toBool();
|
||||
animationProperties.setHold(hold);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("allowTranslation")) {
|
||||
bool allowTranslation = settingsMap["allowTranslation"].toBool();
|
||||
animationProperties.setAllowTranslation(allowTranslation);
|
||||
}
|
||||
|
||||
withWriteLock([&] {
|
||||
auto animationProperties = _animationProperties;
|
||||
|
||||
// the animations setting is a JSON string that may contain various animation settings.
|
||||
// if it includes fps, currentFrame, or running, those values will be parsed out and
|
||||
// will over ride the regular animation settings
|
||||
QJsonDocument settingsAsJson = QJsonDocument::fromJson(value.toUtf8());
|
||||
QJsonObject settingsAsJsonObject = settingsAsJson.object();
|
||||
QVariantMap settingsMap = settingsAsJsonObject.toVariantMap();
|
||||
if (settingsMap.contains("fps")) {
|
||||
float fps = settingsMap["fps"].toFloat();
|
||||
animationProperties.setFPS(fps);
|
||||
}
|
||||
|
||||
// old settings used frameIndex
|
||||
if (settingsMap.contains("frameIndex")) {
|
||||
float currentFrame = settingsMap["frameIndex"].toFloat();
|
||||
animationProperties.setCurrentFrame(currentFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("running")) {
|
||||
bool running = settingsMap["running"].toBool();
|
||||
if (running != animationProperties.getRunning()) {
|
||||
animationProperties.setRunning(running);
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsMap.contains("firstFrame")) {
|
||||
float firstFrame = settingsMap["firstFrame"].toFloat();
|
||||
animationProperties.setFirstFrame(firstFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("lastFrame")) {
|
||||
float lastFrame = settingsMap["lastFrame"].toFloat();
|
||||
animationProperties.setLastFrame(lastFrame);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("loop")) {
|
||||
bool loop = settingsMap["loop"].toBool();
|
||||
animationProperties.setLoop(loop);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("hold")) {
|
||||
bool hold = settingsMap["hold"].toBool();
|
||||
animationProperties.setHold(hold);
|
||||
}
|
||||
|
||||
if (settingsMap.contains("allowTranslation")) {
|
||||
bool allowTranslation = settingsMap["allowTranslation"].toBool();
|
||||
animationProperties.setAllowTranslation(allowTranslation);
|
||||
}
|
||||
applyNewAnimationProperties(animationProperties);
|
||||
});
|
||||
}
|
||||
|
||||
void ModelEntityItem::setAnimationIsPlaying(bool value) {
|
||||
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||
_animationProperties.setRunning(value);
|
||||
withWriteLock([&] {
|
||||
_animationProperties.setRunning(value);
|
||||
});
|
||||
}
|
||||
|
||||
void ModelEntityItem::setAnimationFPS(float value) {
|
||||
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||
_animationProperties.setFPS(value);
|
||||
withWriteLock([&] {
|
||||
_animationProperties.setFPS(value);
|
||||
});
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
@ -557,11 +570,9 @@ void ModelEntityItem::setColor(const xColor& value) {
|
|||
|
||||
// Animation related items...
|
||||
AnimationPropertyGroup ModelEntityItem::getAnimationProperties() const {
|
||||
AnimationPropertyGroup result;
|
||||
withReadLock([&] {
|
||||
result = _animationProperties;
|
||||
return resultWithReadLock<AnimationPropertyGroup>([&] {
|
||||
return _animationProperties;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ModelEntityItem::hasAnimation() const {
|
||||
|
@ -582,6 +593,18 @@ void ModelEntityItem::setAnimationCurrentFrame(float value) {
|
|||
});
|
||||
}
|
||||
|
||||
void ModelEntityItem::setAnimationAllowTranslation(bool value) {
|
||||
withWriteLock([&] {
|
||||
_animationProperties.setAllowTranslation(value);
|
||||
});
|
||||
}
|
||||
|
||||
bool ModelEntityItem::getAnimationAllowTranslation() const {
|
||||
return resultWithReadLock<bool>([&] {
|
||||
return _animationProperties.getAllowTranslation();
|
||||
});
|
||||
}
|
||||
|
||||
void ModelEntityItem::setAnimationLoop(bool loop) {
|
||||
withWriteLock([&] {
|
||||
_animationProperties.setLoop(loop);
|
||||
|
|
|
@ -88,8 +88,8 @@ public:
|
|||
void setAnimationIsPlaying(bool value);
|
||||
void setAnimationFPS(float value);
|
||||
|
||||
void setAnimationAllowTranslation(bool value) { _animationProperties.setAllowTranslation(value); };
|
||||
bool getAnimationAllowTranslation() const { return _animationProperties.getAllowTranslation(); };
|
||||
void setAnimationAllowTranslation(bool value);
|
||||
bool getAnimationAllowTranslation() const;
|
||||
|
||||
void setAnimationLoop(bool loop);
|
||||
bool getAnimationLoop() const;
|
||||
|
|
|
@ -57,7 +57,7 @@ void GL41Backend::postLinkProgram(ShaderObject& programObject, const Shader& pro
|
|||
const auto resourceBufferUniforms = ::gl::Uniform::loadByName(glprogram, program.getResourceBuffers().getNames());
|
||||
for (const auto& resourceBuffer : resourceBufferUniforms) {
|
||||
const auto& targetBinding = expectedResourceBuffers.at(resourceBuffer.name);
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding);
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding + GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<@include Highlight_shared.slh@>
|
||||
|
||||
layout(binding=RENDER_UTILS_BUFFER_HIGHLIGHT_PARAMS) uniform highlightParamsBuffer {
|
||||
layout(std140, binding=RENDER_UTILS_BUFFER_HIGHLIGHT_PARAMS) uniform highlightParamsBuffer {
|
||||
HighlightParameters params;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ struct HighlightParameters {
|
|||
vec2 outlineWidth;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform parametersBuffer {
|
||||
layout(std140, binding=0) uniform parametersBuffer {
|
||||
HighlightParameters _parameters;
|
||||
};
|
||||
|
||||
|
|
18
libraries/render-utils/src/parabola_translucent.slf
Normal file
18
libraries/render-utils/src/parabola_translucent.slf
Normal file
|
@ -0,0 +1,18 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
//
|
||||
// Created by Sam Gondelman on 9/10/2018
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBufferWrite.slh@>
|
||||
|
||||
layout(location=0) in vec4 _color;
|
||||
|
||||
void main(void) {
|
||||
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), _color.a, _color.rgb, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
VERTEX parabola
|
Loading…
Reference in a new issue