Move pathWidth variable in PathPointer back down to specialized classes

This commit is contained in:
sabrina-shanman 2018-09-28 16:04:34 -07:00
parent 0c3f55d6ef
commit b60a62da8f
4 changed files with 14 additions and 9 deletions

View file

@ -29,9 +29,9 @@ void LaserPointer::editRenderStatePath(const std::string& state, const QVariant&
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
if (renderState) {
updateRenderStateOverlay(renderState->getPathID(), pathProps);
QVariant pathWidth = pathProps.toMap()["lineWidth"];
if (pathWidth.isValid()) {
renderState->setPathWidth(pathWidth.toFloat());
QVariant lineWidth = pathProps.toMap()["lineWidth"];
if (lineWidth.isValid()) {
renderState->setLineWidth(lineWidth.toFloat());
}
}
}
@ -118,7 +118,7 @@ LaserPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID
{
if (!_pathID.isNull()) {
_pathIgnoreRays = qApp->getOverlays().getProperty(_pathID, "ignoreRayIntersection").value.toBool();
_pathWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat();
_lineWidth = qApp->getOverlays().getProperty(_pathID, "lineWidth").value.toFloat();
}
}
@ -149,7 +149,7 @@ void LaserPointer::RenderState::update(const glm::vec3& origin, const glm::vec3&
pathProps.insert("end", endVariant);
pathProps.insert("visible", true);
pathProps.insert("ignoreRayIntersection", doesPathIgnoreRays());
pathProps.insert("lineWidth", getPathWidth() * parentScale);
pathProps.insert("lineWidth", getLineWidth() * parentScale);
qApp->getOverlays().editOverlay(getPathID(), pathProps);
}
}

View file

@ -24,6 +24,9 @@ public:
const OverlayID& getPathID() const { return _pathID; }
const bool& doesPathIgnoreRays() const { return _pathIgnoreRays; }
void setLineWidth(float width) { _lineWidth = width; }
float getLineWidth() const { return _lineWidth; }
void cleanup() override;
void disable() override;
void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY,
@ -32,6 +35,8 @@ public:
private:
OverlayID _pathID;
bool _pathIgnoreRays;
float _lineWidth;
};
LaserPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,

View file

@ -79,6 +79,9 @@ public:
RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float parentScale,
bool isVisibleInSecondaryCamera, bool pathEnabled);
void setPathWidth(float width) { _pathWidth = width; }
float getPathWidth() const { return _pathWidth; }
void cleanup() override;
void disable() override;
void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY,
@ -88,6 +91,7 @@ public:
private:
int _pathID;
float _pathWidth;
};
ParabolaPointer(const QVariant& rayProps, const RenderStateMap& renderStates, const DefaultRenderStateMap& defaultRenderStates, bool hover, const PointerTriggers& triggers,

View file

@ -42,9 +42,6 @@ public:
void setEndRot(const glm::quat& endRot) { _endRot = endRot; }
const glm::quat& getEndRot() const { return _endRot; }
void setPathWidth(float width) { _pathWidth = width; }
float getPathWidth() const { return _pathWidth; }
virtual void cleanup();
virtual void disable();
virtual void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, float parentScale, bool distanceScaleEnd, bool centerEndY,
@ -61,7 +58,6 @@ protected:
glm::vec3 _startDim;
glm::vec3 _endDim;
glm::quat _endRot;
float _pathWidth;
glm::quat _avgEndRot;
bool _avgEndRotInitialized { false };