mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
Merge branch 'master' into 20872
Conflicts: examples/html/entityProperties.html
This commit is contained in:
commit
f7f5443a44
25 changed files with 139 additions and 95 deletions
|
@ -480,37 +480,6 @@
|
||||||
var elZTextureURL = document.getElementById("property-z-texture-url");
|
var elZTextureURL = document.getElementById("property-z-texture-url");
|
||||||
|
|
||||||
var elPreviewCameraButton = document.getElementById("preview-camera-button");
|
var elPreviewCameraButton = document.getElementById("preview-camera-button");
|
||||||
|
|
||||||
var urlUpdaters = document.getElementsByClassName("update-url-version");
|
|
||||||
var PARAM_REGEXP = /(?:\?)(\S+)/; // Check if this has any parameters.
|
|
||||||
var TIMESTAMP_REGEXP = /(&?HFTime=\d+)/;
|
|
||||||
|
|
||||||
var refreshEvent = function (event) {
|
|
||||||
var urlElement = event.target.parentElement.getElementsByTagName("INPUT")[0];
|
|
||||||
var content = urlElement.value;
|
|
||||||
var date = new Date();
|
|
||||||
var timeStamp = date.getTime();
|
|
||||||
|
|
||||||
if(content.length > 0){
|
|
||||||
if(PARAM_REGEXP.test(content)){
|
|
||||||
// Has params, so lets remove existing definition and append again.
|
|
||||||
content = content.replace(TIMESTAMP_REGEXP,"") + "&";
|
|
||||||
}else{
|
|
||||||
content += "?";
|
|
||||||
}
|
|
||||||
content = content.replace("?&","?");
|
|
||||||
urlElement.value = content + "HFTime=" + timeStamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
var evt = document.createEvent("HTMLEvents");
|
|
||||||
evt.initEvent("change", true, true );
|
|
||||||
urlElement.dispatchEvent(evt);
|
|
||||||
};
|
|
||||||
|
|
||||||
for(var index = 0; index < urlUpdaters.length; index++){
|
|
||||||
var urlUpdater = urlUpdaters[index];
|
|
||||||
urlUpdater.addEventListener("click", refreshEvent, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window.EventBridge !== undefined) {
|
if (window.EventBridge !== undefined) {
|
||||||
var properties;
|
var properties;
|
||||||
|
@ -1433,20 +1402,17 @@
|
||||||
<option value="3">Edged marching cubes</option>
|
<option value="3">Edged marching cubes</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="spatial-group poly-vox-section property url refresh">
|
<div class="spatial-group poly-vox-section property url ">
|
||||||
<label for="property-x-texture-url">X-axis texture URL</label>
|
<label for="property-x-texture-url">X-axis texture URL</label>
|
||||||
<input type="text" id="property-x-texture-url">
|
<input type="text" id="property-x-texture-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="spatial-group poly-vox-section property url refresh">
|
<div class="spatial-group poly-vox-section property url ">
|
||||||
<label for="property-y-texture-url">Y-axis texture URL</label>
|
<label for="property-y-texture-url">Y-axis texture URL</label>
|
||||||
<input type="text" id="property-y-texture-url">
|
<input type="text" id="property-y-texture-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="spatial-group poly-vox-section property url refresh">
|
<div class="spatial-group poly-vox-section property url ">
|
||||||
<label for="property-z-texture-url">Z-axis texture URL</label>
|
<label for="property-z-texture-url">Z-axis texture URL</label>
|
||||||
<input type="text" id="property-z-texture-url">
|
<input type="text" id="property-z-texture-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<hr class="spatial-group" />
|
<hr class="spatial-group" />
|
||||||
<div class="spatial-group property pyr">
|
<div class="spatial-group property pyr">
|
||||||
|
@ -1593,17 +1559,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="behavior-group" />
|
<hr class="behavior-group" />
|
||||||
<div class="behavior-group property url refresh">
|
<div class="behavior-group property url ">
|
||||||
<label for="property-collision-sound-url">Collision sound URL</label>
|
<label for="property-collision-sound-url">Collision sound URL</label>
|
||||||
<input type="text" id="property-collision-sound-url">
|
<input type="text" id="property-collision-sound-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="behavior-group property number">
|
<div class="behavior-group property number">
|
||||||
<label>Lifetime <span class="unit">s</span></label>
|
<label>Lifetime <span class="unit">s</span></label>
|
||||||
<input type="number" id="property-lifetime">
|
<input type="number" id="property-lifetime">
|
||||||
</div>
|
</div>
|
||||||
<hr class="behavior-group" />
|
<hr class="behavior-group" />
|
||||||
<div class="behavior-group property url refresh">
|
<div class="behavior-group property url ">
|
||||||
<!--
|
<!--
|
||||||
FIXME: If reload buttons at the end of each URL continue to work OK during beta, this reload button and associated
|
FIXME: If reload buttons at the end of each URL continue to work OK during beta, this reload button and associated
|
||||||
code should be removed.
|
code should be removed.
|
||||||
|
@ -1612,17 +1577,15 @@
|
||||||
-->
|
-->
|
||||||
<label for="property-script-url">Script URL</label>
|
<label for="property-script-url">Script URL</label>
|
||||||
<input type="text" id="property-script-url">
|
<input type="text" id="property-script-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="section-header model-group model-section zone-section">
|
<div class="section-header model-group model-section zone-section">
|
||||||
<label>Model</label><span>M</span>
|
<label>Model</label><span>M</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-group model-section property url refresh">
|
<div class="model-group model-section property url ">
|
||||||
<label for="property-model-url">Model URL</label>
|
<label for="property-model-url">Model URL</label>
|
||||||
<input type="text" id="property-model-url">
|
<input type="text" id="property-model-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="model-group model-section zone-section property dropdown">
|
<div class="model-group model-section zone-section property dropdown">
|
||||||
<label>Collision shape type</label>
|
<label>Collision shape type</label>
|
||||||
|
@ -1633,16 +1596,14 @@
|
||||||
<option value="compound">Compound</option>
|
<option value="compound">Compound</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-group model-section zone-section property url refresh">
|
<div class="model-group model-section zone-section property url ">
|
||||||
<label for="property-compound-shape-url">Compound shape URL</label>
|
<label for="property-compound-shape-url">Compound shape URL</label>
|
||||||
<input type="text" id="property-compound-shape-url">
|
<input type="text" id="property-compound-shape-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
<hr class="model-group model-section" />
|
<hr class="model-group model-section" />
|
||||||
<div class="model-group model-section property url refresh">
|
<div class="model-group model-section property url ">
|
||||||
<label for="property-model-animation-url">Animation URL</label>
|
<label for="property-model-animation-url">Animation URL</label>
|
||||||
<input type="text" id="property-model-animation-url">
|
<input type="text" id="property-model-animation-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="model-group model-section two-column">
|
<div class="model-group model-section two-column">
|
||||||
|
@ -1756,10 +1717,9 @@
|
||||||
<label>Ambient intensity</label>
|
<label>Ambient intensity</label>
|
||||||
<input type="number" id="property-zone-key-ambient-intensity" min="0" max="10" step="0.1">
|
<input type="number" id="property-zone-key-ambient-intensity" min="0" max="10" step="0.1">
|
||||||
</div>
|
</div>
|
||||||
<div class="zone-group zone-section keylight-section property url refresh">
|
<div class="zone-group zone-section keylight-section property url ">
|
||||||
<label for="property-zone-key-ambient-url">Ambient URL</label>
|
<label for="property-zone-key-ambient-url">Ambient URL</label>
|
||||||
<input type="text" id="property-zone-key-ambient-url">
|
<input type="text" id="property-zone-key-ambient-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sub-section-header zone-group zone-section stage-section">
|
<div class="sub-section-header zone-group zone-section stage-section">
|
||||||
|
@ -1808,20 +1768,18 @@
|
||||||
<div><input type="number" class="blue" id="property-zone-skybox-color-blue"><label for="property-zone-skybox-color-blue">Blue:</label></div>
|
<div><input type="number" class="blue" id="property-zone-skybox-color-blue"><label for="property-zone-skybox-color-blue">Blue:</label></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="zone-group zone-section skybox-section property url refresh">
|
<div class="zone-group zone-section skybox-section property url ">
|
||||||
<label for="property-zone-skybox-url">Skybox URL</label>
|
<label for="property-zone-skybox-url">Skybox URL</label>
|
||||||
<input type="text" id="property-zone-skybox-url">
|
<input type="text" id="property-zone-skybox-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="section-header web-group web-section">
|
<div class="section-header web-group web-section">
|
||||||
<label>Web</label><span>M</span>
|
<label>Web</label><span>M</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="web-group web-section property url refresh">
|
<div class="web-group web-section property url ">
|
||||||
<label for="property-web-source-url">Source URL</label>
|
<label for="property-web-source-url">Source URL</label>
|
||||||
<input type="text" id="property-web-source-url">
|
<input type="text" id="property-web-source-url">
|
||||||
<input type="button" class="update-url-version glyph" value="F" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ Script.include([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var isActive = false;
|
var isActive = false;
|
||||||
var toolIconUrl = "http://headache.hungry.com/~seth/hifi/";
|
var toolIconUrl = "https://s3-us-west-1.amazonaws.com/hifi-content/seth/production/icons/"
|
||||||
|
|
||||||
var toolHeight = 50;
|
var toolHeight = 50;
|
||||||
var toolWidth = 50;
|
var toolWidth = 50;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Desktop {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
WebEngine.settings.javascriptCanOpenWindows = true;
|
WebEngine.settings.javascriptCanOpenWindows = true;
|
||||||
WebEngine.settings.javascriptCanAccessClipboard = false;
|
WebEngine.settings.javascriptCanAccessClipboard = false;
|
||||||
WebEngine.settings.spatialNavigationEnabled = true;
|
WebEngine.settings.spatialNavigationEnabled = false;
|
||||||
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
WebEngine.settings.localContentCanAccessRemoteUrls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,9 +187,10 @@ void Avatar::simulate(float deltaTime) {
|
||||||
|
|
||||||
// simple frustum check
|
// simple frustum check
|
||||||
float boundingRadius = getBoundingRadius();
|
float boundingRadius = getBoundingRadius();
|
||||||
bool inView = qApp->getDisplayViewFrustum()->sphereIntersectsFrustum(getPosition(), boundingRadius);
|
bool avatarPositionInView = qApp->getDisplayViewFrustum()->sphereIntersectsFrustum(getPosition(), boundingRadius);
|
||||||
|
bool avatarMeshInView = qApp->getDisplayViewFrustum()->boxIntersectsFrustum(_skeletonModel->getRenderableMeshBound());
|
||||||
|
|
||||||
if (_shouldAnimate && !_shouldSkipRender && inView) {
|
if (_shouldAnimate && !_shouldSkipRender && (avatarPositionInView || avatarMeshInView)) {
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("skeleton");
|
PerformanceTimer perfTimer("skeleton");
|
||||||
_skeletonModel->getRig()->copyJointsFromJointData(_jointData);
|
_skeletonModel->getRig()->copyJointsFromJointData(_jointData);
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
public: \
|
public: \
|
||||||
virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { return _renderHelper.addToScene(self, scene, pendingChanges); } \
|
virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { return _renderHelper.addToScene(self, scene, pendingChanges); } \
|
||||||
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { _renderHelper.removeFromScene(self, scene, pendingChanges); } \
|
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { _renderHelper.removeFromScene(self, scene, pendingChanges); } \
|
||||||
virtual void locationChanged() override { EntityItem::locationChanged(); _renderHelper.notifyChanged(); } \
|
virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); _renderHelper.notifyChanged(); } \
|
||||||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); _renderHelper.notifyChanged(); } \
|
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); _renderHelper.notifyChanged(); } \
|
||||||
private: \
|
private: \
|
||||||
SimpleRenderableEntityItem _renderHelper;
|
SimpleRenderableEntityItem _renderHelper;
|
||||||
|
|
|
@ -271,10 +271,10 @@ bool RenderableModelEntityItem::getAnimationFrame() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasAnimation() || !_jointMappingCompleted) {
|
if (!hasRenderAnimation() || !_jointMappingCompleted) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AnimationPointer myAnimation = getAnimation(_animationProperties.getURL()); // FIXME: this could be optimized
|
AnimationPointer myAnimation = getAnimation(getRenderAnimationURL()); // FIXME: this could be optimized
|
||||||
if (myAnimation && myAnimation->isLoaded()) {
|
if (myAnimation && myAnimation->isLoaded()) {
|
||||||
|
|
||||||
const QVector<FBXAnimationFrame>& frames = myAnimation->getFramesReference(); // NOTE: getFrames() is too heavy
|
const QVector<FBXAnimationFrame>& frames = myAnimation->getFramesReference(); // NOTE: getFrames() is too heavy
|
||||||
|
@ -384,7 +384,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_model) {
|
if (_model) {
|
||||||
if (hasAnimation()) {
|
if (hasRenderAnimation()) {
|
||||||
if (!jointsMapped()) {
|
if (!jointsMapped()) {
|
||||||
QStringList modelJointNames = _model->getJointNames();
|
QStringList modelJointNames = _model->getJointNames();
|
||||||
mapJoints(modelJointNames);
|
mapJoints(modelJointNames);
|
||||||
|
@ -528,6 +528,9 @@ void RenderableModelEntityItem::update(const quint64& now) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make a copy of the animation properites
|
||||||
|
_renderAnimationProperties = _animationProperties;
|
||||||
|
|
||||||
ModelEntityItem::update(now);
|
ModelEntityItem::update(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,8 +798,8 @@ void RenderableModelEntityItem::setJointTranslationsSet(const QVector<bool>& tra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RenderableModelEntityItem::locationChanged() {
|
void RenderableModelEntityItem::locationChanged(bool tellPhysics) {
|
||||||
EntityItem::locationChanged();
|
EntityItem::locationChanged(tellPhysics);
|
||||||
if (_model && _model->isActive()) {
|
if (_model && _model->isActive()) {
|
||||||
_model->setRotation(getRotation());
|
_model->setRotation(getRotation());
|
||||||
_model->setTranslation(getPosition());
|
_model->setTranslation(getPosition());
|
||||||
|
|
|
@ -75,13 +75,18 @@ public:
|
||||||
virtual void setJointTranslationsSet(const QVector<bool>& translationsSet) override;
|
virtual void setJointTranslationsSet(const QVector<bool>& translationsSet) override;
|
||||||
|
|
||||||
virtual void loader() override;
|
virtual void loader() override;
|
||||||
virtual void locationChanged() override;
|
virtual void locationChanged(bool tellPhysics = true) override;
|
||||||
|
|
||||||
virtual void resizeJointArrays(int newSize = -1) override;
|
virtual void resizeJointArrays(int newSize = -1) override;
|
||||||
|
|
||||||
virtual int getJointIndex(const QString& name) const override;
|
virtual int getJointIndex(const QString& name) const override;
|
||||||
virtual QStringList getJointNames() const override;
|
virtual QStringList getJointNames() const override;
|
||||||
|
|
||||||
|
// These operate on a copy of the renderAnimationProperties, so they can be accessed
|
||||||
|
// without having the entityTree lock.
|
||||||
|
bool hasRenderAnimation() const { return !_renderAnimationProperties.getURL().isEmpty(); }
|
||||||
|
const QString& getRenderAnimationURL() const { return _renderAnimationProperties.getURL(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap parseTexturesToMap(QString textures);
|
QVariantMap parseTexturesToMap(QString textures);
|
||||||
void remapTextures();
|
void remapTextures();
|
||||||
|
@ -97,6 +102,8 @@ private:
|
||||||
QVector<QVector<glm::vec3>> _points;
|
QVector<QVector<glm::vec3>> _points;
|
||||||
bool _dimensionsInitialized = true;
|
bool _dimensionsInitialized = true;
|
||||||
|
|
||||||
|
AnimationPropertyGroup _renderAnimationProperties;
|
||||||
|
|
||||||
render::ItemID _myMetaItem{ render::Item::INVALID_ITEM_ID };
|
render::ItemID _myMetaItem{ render::Item::INVALID_ITEM_ID };
|
||||||
|
|
||||||
bool _showCollisionHull = false;
|
bool _showCollisionHull = false;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
InterpolationData<float> radius;
|
InterpolationData<float> radius;
|
||||||
InterpolationData<glm::vec4> color; // rgba
|
InterpolationData<glm::vec4> color; // rgba
|
||||||
float lifespan;
|
float lifespan;
|
||||||
|
glm::vec3 spare;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ParticlePrimitive {
|
struct ParticlePrimitive {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
virtual void removeFromScene(EntityItemPointer self, render::ScenePointer scene, render::PendingChanges& pendingChanges) override;
|
virtual void removeFromScene(EntityItemPointer self, render::ScenePointer scene, render::PendingChanges& pendingChanges) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void locationChanged() override { EntityItem::locationChanged(); notifyBoundChanged(); }
|
virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); notifyBoundChanged(); }
|
||||||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
||||||
|
|
||||||
void notifyBoundChanged();
|
void notifyBoundChanged();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges);
|
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void locationChanged() override { EntityItem::locationChanged(); notifyBoundChanged(); }
|
virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); notifyBoundChanged(); }
|
||||||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
||||||
void notifyBoundChanged();
|
void notifyBoundChanged();
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ struct Colors {
|
||||||
struct ParticleUniforms {
|
struct ParticleUniforms {
|
||||||
Radii radius;
|
Radii radius;
|
||||||
Colors color;
|
Colors color;
|
||||||
float lifespan;
|
vec4 lifespan; // x is lifespan, 3 spare floats
|
||||||
};
|
};
|
||||||
|
|
||||||
uniform particleBuffer {
|
layout(std140) uniform particleBuffer {
|
||||||
ParticleUniforms particle;
|
ParticleUniforms particle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void main(void) {
|
||||||
int twoTriID = gl_VertexID - particleID * NUM_VERTICES_PER_PARTICLE;
|
int twoTriID = gl_VertexID - particleID * NUM_VERTICES_PER_PARTICLE;
|
||||||
|
|
||||||
// Particle properties
|
// Particle properties
|
||||||
float age = inColor.x / particle.lifespan;
|
float age = inColor.x / particle.lifespan.x;
|
||||||
float seed = inColor.y;
|
float seed = inColor.y;
|
||||||
|
|
||||||
// Pass the texcoord and the z texcoord is representing the texture icon
|
// Pass the texcoord and the z texcoord is representing the texture icon
|
||||||
|
|
|
@ -244,6 +244,10 @@ void AnimationPropertyGroup::markAllChanged() {
|
||||||
_fpsChanged = true;
|
_fpsChanged = true;
|
||||||
_currentFrameChanged = true;
|
_currentFrameChanged = true;
|
||||||
_runningChanged = true;
|
_runningChanged = true;
|
||||||
|
_loopChanged = true;
|
||||||
|
_firstFrameChanged = true;
|
||||||
|
_lastFrameChanged = true;
|
||||||
|
_holdChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPropertyFlags AnimationPropertyGroup::getChangedProperties() const {
|
EntityPropertyFlags AnimationPropertyGroup::getChangedProperties() const {
|
||||||
|
|
|
@ -888,9 +888,6 @@ void EntityItem::simulateKinematicMotion(float timeElapsed, bool setFlags) {
|
||||||
if (hasActions()) {
|
if (hasActions()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_parentID.isNull()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasLocalAngularVelocity()) {
|
if (hasLocalAngularVelocity()) {
|
||||||
glm::vec3 localAngularVelocity = getLocalAngularVelocity();
|
glm::vec3 localAngularVelocity = getLocalAngularVelocity();
|
||||||
|
@ -1976,14 +1973,16 @@ QList<EntityActionPointer> EntityItem::getActionsOfType(EntityActionType typeToG
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::locationChanged() {
|
void EntityItem::locationChanged(bool tellPhysics) {
|
||||||
requiresRecalcBoxes();
|
requiresRecalcBoxes();
|
||||||
_dirtyFlags |= Simulation::DIRTY_TRANSFORM;
|
if (tellPhysics) {
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_TRANSFORM;
|
||||||
|
}
|
||||||
EntityTreePointer tree = getTree();
|
EntityTreePointer tree = getTree();
|
||||||
if (tree) {
|
if (tree) {
|
||||||
tree->entityChanged(getThisPointer());
|
tree->entityChanged(getThisPointer());
|
||||||
}
|
}
|
||||||
SpatiallyNestable::locationChanged(); // tell all the children, also
|
SpatiallyNestable::locationChanged(tellPhysics); // tell all the children, also
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::dimensionsChanged() {
|
void EntityItem::dimensionsChanged() {
|
||||||
|
|
|
@ -432,7 +432,7 @@ protected:
|
||||||
const QByteArray getActionDataInternal() const;
|
const QByteArray getActionDataInternal() const;
|
||||||
void setActionDataInternal(QByteArray actionData);
|
void setActionDataInternal(QByteArray actionData);
|
||||||
|
|
||||||
virtual void locationChanged() override;
|
virtual void locationChanged(bool tellPhysics = true) override;
|
||||||
virtual void dimensionsChanged() override;
|
virtual void dimensionsChanged() override;
|
||||||
|
|
||||||
EntityTypes::EntityType _type;
|
EntityTypes::EntityType _type;
|
||||||
|
|
|
@ -12,11 +12,12 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
||||||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||||
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
||||||
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
||||||
format.setVersion(4, 5);
|
setGLFormatVersion(format);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
#endif
|
#endif
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
});
|
});
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
@ -27,11 +28,12 @@ const QGLFormat& getDefaultGLFormat() {
|
||||||
static QGLFormat glFormat;
|
static QGLFormat glFormat;
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [] {
|
std::call_once(once, [] {
|
||||||
glFormat.setVersion(4, 5);
|
setGLFormatVersion(glFormat);
|
||||||
glFormat.setProfile(QGLFormat::CoreProfile); // Requires >=Qt-4.8.0
|
glFormat.setProfile(QGLFormat::CoreProfile); // Requires >=Qt-4.8.0
|
||||||
glFormat.setSampleBuffers(false);
|
glFormat.setSampleBuffers(false);
|
||||||
glFormat.setDepth(false);
|
glFormat.setDepth(false);
|
||||||
glFormat.setStencil(false);
|
glFormat.setStencil(false);
|
||||||
|
QGLFormat::setDefaultFormat(glFormat);
|
||||||
});
|
});
|
||||||
return glFormat;
|
return glFormat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
class QSurfaceFormat;
|
class QSurfaceFormat;
|
||||||
class QGLFormat;
|
class QGLFormat;
|
||||||
|
|
||||||
|
template<class F>
|
||||||
|
void setGLFormatVersion(F& format, int major = 4, int minor = 5) { format.setVersion(major, minor); }
|
||||||
|
|
||||||
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
|
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
|
||||||
const QGLFormat& getDefaultGLFormat();
|
const QGLFormat& getDefaultGLFormat();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -569,7 +569,7 @@ QPointF OffscreenQmlSurface::mapToVirtualScreen(const QPointF& originalPoint, QO
|
||||||
// Event handling customization
|
// Event handling customization
|
||||||
//
|
//
|
||||||
|
|
||||||
bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* event) {
|
bool OffscreenQmlSurface::filterEnabled(QObject* originalDestination, QEvent* event) const {
|
||||||
if (_renderer->_quickWindow == originalDestination) {
|
if (_renderer->_quickWindow == originalDestination) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,13 @@ bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* even
|
||||||
if (_paused) {
|
if (_paused) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
|
if (!filterEnabled(originalDestination, event)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Don't intercept our own events, or we enter an infinite recursion
|
// Don't intercept our own events, or we enter an infinite recursion
|
||||||
QObject* recurseTest = originalDestination;
|
QObject* recurseTest = originalDestination;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
QQmlContext* getRootContext();
|
QQmlContext* getRootContext();
|
||||||
|
|
||||||
QPointF mapToVirtualScreen(const QPointF& originalPoint, QObject* originalWidget);
|
QPointF mapToVirtualScreen(const QPointF& originalPoint, QObject* originalWidget);
|
||||||
virtual bool eventFilter(QObject* originalDestination, QEvent* event);
|
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void textureUpdated(unsigned int texture);
|
void textureUpdated(unsigned int texture);
|
||||||
|
@ -76,6 +76,9 @@ public slots:
|
||||||
void requestRender();
|
void requestRender();
|
||||||
void onAboutToQuit();
|
void onAboutToQuit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool filterEnabled(QObject* originalDestination, QEvent* event) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QObject* finishQmlLoad(std::function<void(QQmlContext*, QObject*)> f);
|
QObject* finishQmlLoad(std::function<void(QQmlContext*, QObject*)> f);
|
||||||
QPointF mapWindowToUi(const QPointF& sourcePosition, QObject* sourceObject);
|
QPointF mapWindowToUi(const QPointF& sourcePosition, QObject* sourceObject);
|
||||||
|
|
|
@ -207,8 +207,16 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
|
|
||||||
assert(entityTreeIsLocked());
|
assert(entityTreeIsLocked());
|
||||||
measureBodyAcceleration();
|
measureBodyAcceleration();
|
||||||
_entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset());
|
bool positionSuccess;
|
||||||
_entity->setRotation(bulletToGLM(worldTrans.getRotation()));
|
_entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false);
|
||||||
|
if (!positionSuccess) {
|
||||||
|
qDebug() << "EntityMotionState::setWorldTransform setPosition failed" << _entity->getID();
|
||||||
|
}
|
||||||
|
bool orientationSuccess;
|
||||||
|
_entity->setOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
|
||||||
|
if (!orientationSuccess) {
|
||||||
|
qDebug() << "EntityMotionState::setWorldTransform setOrientation failed" << _entity->getID();
|
||||||
|
}
|
||||||
_entity->setVelocity(getBodyLinearVelocity());
|
_entity->setVelocity(getBodyLinearVelocity());
|
||||||
_entity->setAngularVelocity(getBodyAngularVelocity());
|
_entity->setAngularVelocity(getBodyAngularVelocity());
|
||||||
_entity->setLastSimulated(usecTimestampNow());
|
_entity->setLastSimulated(usecTimestampNow());
|
||||||
|
|
|
@ -314,7 +314,7 @@ glm::vec3 SpatiallyNestable::getPosition(int jointIndex, bool& success) const {
|
||||||
return getTransform(jointIndex, success).getTranslation();
|
return getTransform(jointIndex, success).getTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success) {
|
void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success, bool tellPhysics) {
|
||||||
// guard against introducing NaN into the transform
|
// guard against introducing NaN into the transform
|
||||||
if (isNaN(position)) {
|
if (isNaN(position)) {
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -328,7 +328,7 @@ void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success) {
|
||||||
Transform::inverseMult(_transform, parentTransform, myWorldTransform);
|
Transform::inverseMult(_transform, parentTransform, myWorldTransform);
|
||||||
});
|
});
|
||||||
if (success) {
|
if (success) {
|
||||||
locationChanged();
|
locationChanged(tellPhysics);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "setPosition failed for" << getID();
|
qDebug() << "setPosition failed for" << getID();
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ glm::quat SpatiallyNestable::getOrientation(int jointIndex, bool& success) const
|
||||||
return getTransform(jointIndex, success).getRotation();
|
return getTransform(jointIndex, success).getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setOrientation(const glm::quat& orientation, bool& success) {
|
void SpatiallyNestable::setOrientation(const glm::quat& orientation, bool& success, bool tellPhysics) {
|
||||||
// guard against introducing NaN into the transform
|
// guard against introducing NaN into the transform
|
||||||
if (isNaN(orientation)) {
|
if (isNaN(orientation)) {
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -378,7 +378,7 @@ void SpatiallyNestable::setOrientation(const glm::quat& orientation, bool& succe
|
||||||
Transform::inverseMult(_transform, parentTransform, myWorldTransform);
|
Transform::inverseMult(_transform, parentTransform, myWorldTransform);
|
||||||
});
|
});
|
||||||
if (success) {
|
if (success) {
|
||||||
locationChanged();
|
locationChanged(tellPhysics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,8 +422,18 @@ void SpatiallyNestable::setVelocity(const glm::vec3& velocity, bool& success) {
|
||||||
glm::vec3 parentVelocity = getParentVelocity(success);
|
glm::vec3 parentVelocity = getParentVelocity(success);
|
||||||
Transform parentTransform = getParentTransform(success);
|
Transform parentTransform = getParentTransform(success);
|
||||||
_velocityLock.withWriteLock([&] {
|
_velocityLock.withWriteLock([&] {
|
||||||
// TODO: take parent angularVelocity into account.
|
// HACK: until we are treating _velocity the same way we treat _position (meaning,
|
||||||
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
// _velocity is a vs parent value and any request for a world-frame velocity must
|
||||||
|
// be computed), do this to avoid equipped (parenting-grabbed) things from drifting.
|
||||||
|
// turning a zero velocity into a non-zero _velocity (because the avatar is moving)
|
||||||
|
// causes EntityItem::simulateKinematicMotion to have an effect on the equipped entity,
|
||||||
|
// which causes it to drift from the hand.
|
||||||
|
if (hasAncestorOfType(NestableType::Avatar)) {
|
||||||
|
_velocity = velocity;
|
||||||
|
} else {
|
||||||
|
// TODO: take parent angularVelocity into account.
|
||||||
|
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,9 +761,9 @@ void SpatiallyNestable::forEachDescendant(std::function<void(SpatiallyNestablePo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::locationChanged() {
|
void SpatiallyNestable::locationChanged(bool tellPhysics) {
|
||||||
forEachChild([&](SpatiallyNestablePointer object) {
|
forEachChild([&](SpatiallyNestablePointer object) {
|
||||||
object->locationChanged();
|
object->locationChanged(tellPhysics);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,13 +59,13 @@ public:
|
||||||
|
|
||||||
virtual glm::vec3 getPosition(bool& success) const;
|
virtual glm::vec3 getPosition(bool& success) const;
|
||||||
virtual glm::vec3 getPosition() const;
|
virtual glm::vec3 getPosition() const;
|
||||||
virtual void setPosition(const glm::vec3& position, bool& success);
|
virtual void setPosition(const glm::vec3& position, bool& success, bool tellPhysics = true);
|
||||||
virtual void setPosition(const glm::vec3& position);
|
virtual void setPosition(const glm::vec3& position);
|
||||||
|
|
||||||
virtual glm::quat getOrientation(bool& success) const;
|
virtual glm::quat getOrientation(bool& success) const;
|
||||||
virtual glm::quat getOrientation() const;
|
virtual glm::quat getOrientation() const;
|
||||||
virtual glm::quat getOrientation(int jointIndex, bool& success) const;
|
virtual glm::quat getOrientation(int jointIndex, bool& success) const;
|
||||||
virtual void setOrientation(const glm::quat& orientation, bool& success);
|
virtual void setOrientation(const glm::quat& orientation, bool& success, bool tellPhysics = true);
|
||||||
virtual void setOrientation(const glm::quat& orientation);
|
virtual void setOrientation(const glm::quat& orientation);
|
||||||
|
|
||||||
virtual glm::vec3 getVelocity(bool& success) const;
|
virtual glm::vec3 getVelocity(bool& success) const;
|
||||||
|
@ -159,7 +159,7 @@ protected:
|
||||||
mutable ReadWriteLockable _childrenLock;
|
mutable ReadWriteLockable _childrenLock;
|
||||||
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
|
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
|
||||||
|
|
||||||
virtual void locationChanged(); // called when a this object's location has changed
|
virtual void locationChanged(bool tellPhysics = true); // called when a this object's location has changed
|
||||||
virtual void dimensionsChanged() { } // called when a this object's dimensions have changed
|
virtual void dimensionsChanged() { } // called when a this object's dimensions have changed
|
||||||
|
|
||||||
// _queryAACube is used to decide where something lives in the octree
|
// _queryAACube is used to decide where something lives in the octree
|
||||||
|
|
|
@ -563,5 +563,38 @@ QString OffscreenUi::getSaveFileName(void* ignored, const QString &caption, cons
|
||||||
return DependencyManager::get<OffscreenUi>()->fileSaveDialog(caption, dir, filter, selectedFilter, options);
|
return DependencyManager::get<OffscreenUi>()->fileSaveDialog(caption, dir, filter, selectedFilter, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
|
if (!filterEnabled(originalDestination, event)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// let the parent class do it's work
|
||||||
|
bool result = OffscreenQmlSurface::eventFilter(originalDestination, event);
|
||||||
|
|
||||||
|
// Check if this is a key press/release event that might need special attention
|
||||||
|
auto type = event->type();
|
||||||
|
if (type != QEvent::KeyPress && type != QEvent::KeyRelease) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(event);
|
||||||
|
bool& pressed = _pressedKeys[keyEvent->key()];
|
||||||
|
|
||||||
|
// Keep track of which key press events the QML has accepted
|
||||||
|
if (result && QEvent::KeyPress == type) {
|
||||||
|
pressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QML input elements absorb key press, but apparently not key release.
|
||||||
|
// therefore we want to ensure that key release events for key presses that were
|
||||||
|
// accepted by the QML layer are suppressed
|
||||||
|
if (!result && type == QEvent::KeyRelease && pressed) {
|
||||||
|
pressed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#include "OffscreenUi.moc"
|
#include "OffscreenUi.moc"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#ifndef hifi_OffscreenUi_h
|
#ifndef hifi_OffscreenUi_h
|
||||||
#define hifi_OffscreenUi_h
|
#define hifi_OffscreenUi_h
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
#include <QtWidgets/QMessageBox>
|
#include <QtWidgets/QMessageBox>
|
||||||
|
@ -37,6 +38,7 @@ public:
|
||||||
void setNavigationFocused(bool focused);
|
void setNavigationFocused(bool focused);
|
||||||
void unfocusWindows();
|
void unfocusWindows();
|
||||||
void toggleMenu(const QPoint& screenCoordinates);
|
void toggleMenu(const QPoint& screenCoordinates);
|
||||||
|
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||||
|
|
||||||
QQuickItem* getDesktop();
|
QQuickItem* getDesktop();
|
||||||
QQuickItem* getToolWindow();
|
QQuickItem* getToolWindow();
|
||||||
|
@ -131,6 +133,7 @@ private:
|
||||||
|
|
||||||
QQuickItem* _desktop { nullptr };
|
QQuickItem* _desktop { nullptr };
|
||||||
QQuickItem* _toolWindow { nullptr };
|
QQuickItem* _toolWindow { nullptr };
|
||||||
|
std::unordered_map<int, bool> _pressedKeys;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#include <gl/QOpenGLContextWrapper.h>
|
#include <gl/QOpenGLContextWrapper.h>
|
||||||
#include <gl/QOpenGLDebugLoggerWrapper.h>
|
#include <gl/QOpenGLDebugLoggerWrapper.h>
|
||||||
|
#include <gl/GLHelpers.h>
|
||||||
|
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
|
@ -141,7 +142,7 @@ public:
|
||||||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||||
format.setDepthBufferSize(16);
|
format.setDepthBufferSize(16);
|
||||||
format.setStencilBufferSize(8);
|
format.setStencilBufferSize(8);
|
||||||
format.setVersion(4, 3);
|
setGLFormatVersion(format);
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
format.setSwapInterval(0);
|
format.setSwapInterval(0);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <gl/QOpenGLContextWrapper.h>
|
#include <gl/QOpenGLContextWrapper.h>
|
||||||
#include <gl/QOpenGLDebugLoggerWrapper.h>
|
#include <gl/QOpenGLDebugLoggerWrapper.h>
|
||||||
|
#include <gl/GLHelpers.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
@ -98,7 +99,7 @@ public:
|
||||||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||||
format.setDepthBufferSize(16);
|
format.setDepthBufferSize(16);
|
||||||
format.setStencilBufferSize(8);
|
format.setStencilBufferSize(8);
|
||||||
format.setVersion(4, 1);
|
setGLFormatVersion(format);
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
format.setOption(QSurfaceFormat::DebugContext);
|
format.setOption(QSurfaceFormat::DebugContext);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue