mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 08:26:36 +02:00
Merge remote-tracking branch 'SamGondelman/parabolic2' into M17217-b
This commit is contained in:
commit
f65b1a26ae
3 changed files with 35 additions and 14 deletions
|
@ -20,6 +20,7 @@
|
||||||
const glm::vec4 ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR { 1.0f };
|
const glm::vec4 ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR { 1.0f };
|
||||||
const float ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH { 0.01f };
|
const float ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH { 0.01f };
|
||||||
const bool ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA { false };
|
const bool ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA { false };
|
||||||
|
const bool ParabolaPointer::RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_DRAWINFRONT { false };
|
||||||
|
|
||||||
gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::_parabolaPipeline { nullptr };
|
gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::_parabolaPipeline { nullptr };
|
||||||
gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::_transparentParabolaPipeline { nullptr };
|
gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::_transparentParabolaPipeline { nullptr };
|
||||||
|
@ -40,6 +41,7 @@ void ParabolaPointer::editRenderStatePath(const std::string& state, const QVaria
|
||||||
float alpha = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR.a;
|
float alpha = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR.a;
|
||||||
float width = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH;
|
float width = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH;
|
||||||
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
||||||
|
bool drawInFront = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_DRAWINFRONT;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
if (!pathMap.isEmpty()) {
|
if (!pathMap.isEmpty()) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -57,8 +59,11 @@ void ParabolaPointer::editRenderStatePath(const std::string& state, const QVaria
|
||||||
if (pathMap["isVisibleInSecondaryCamera"].isValid()) {
|
if (pathMap["isVisibleInSecondaryCamera"].isValid()) {
|
||||||
isVisibleInSecondaryCamera = pathMap["isVisibleInSecondaryCamera"].toBool();
|
isVisibleInSecondaryCamera = pathMap["isVisibleInSecondaryCamera"].toBool();
|
||||||
}
|
}
|
||||||
|
if (pathMap["drawInFront"].isValid()) {
|
||||||
|
drawInFront = pathMap["drawInFront"].toBool();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
renderState->editParabola(color, alpha, width, isVisibleInSecondaryCamera, enabled);
|
renderState->editParabola(color, alpha, width, isVisibleInSecondaryCamera, drawInFront, enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +113,7 @@ void ParabolaPointer::setVisualPickResultInternal(PickResultPointer pickResult,
|
||||||
}
|
}
|
||||||
|
|
||||||
ParabolaPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth,
|
ParabolaPointer::RenderState::RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth,
|
||||||
bool isVisibleInSecondaryCamera, bool pathEnabled) :
|
bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled) :
|
||||||
StartEndRenderState(startID, endID)
|
StartEndRenderState(startID, endID)
|
||||||
{
|
{
|
||||||
render::Transaction transaction;
|
render::Transaction transaction;
|
||||||
|
@ -116,7 +121,7 @@ ParabolaPointer::RenderState::RenderState(const OverlayID& startID, const Overla
|
||||||
_pathID = scene->allocateID();
|
_pathID = scene->allocateID();
|
||||||
_pathWidth = pathWidth;
|
_pathWidth = pathWidth;
|
||||||
if (render::Item::isValidID(_pathID)) {
|
if (render::Item::isValidID(_pathID)) {
|
||||||
auto renderItem = std::make_shared<ParabolaRenderItem>(pathColor, pathAlpha, pathWidth, isVisibleInSecondaryCamera, pathEnabled);
|
auto renderItem = std::make_shared<ParabolaRenderItem>(pathColor, pathAlpha, pathWidth, isVisibleInSecondaryCamera, drawInFront, pathEnabled);
|
||||||
transaction.resetItem(_pathID, std::make_shared<ParabolaRenderItem::Payload>(renderItem));
|
transaction.resetItem(_pathID, std::make_shared<ParabolaRenderItem::Payload>(renderItem));
|
||||||
scene->enqueueTransaction(transaction);
|
scene->enqueueTransaction(transaction);
|
||||||
}
|
}
|
||||||
|
@ -144,15 +149,16 @@ void ParabolaPointer::RenderState::disable() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParabolaPointer::RenderState::editParabola(const glm::vec3& color, float alpha, float width, bool isVisibleInSecondaryCamera, bool enabled) {
|
void ParabolaPointer::RenderState::editParabola(const glm::vec3& color, float alpha, float width, bool isVisibleInSecondaryCamera, bool drawInFront, bool enabled) {
|
||||||
if (render::Item::isValidID(_pathID)) {
|
if (render::Item::isValidID(_pathID)) {
|
||||||
render::Transaction transaction;
|
render::Transaction transaction;
|
||||||
auto scene = qApp->getMain3DScene();
|
auto scene = qApp->getMain3DScene();
|
||||||
transaction.updateItem<ParabolaRenderItem>(_pathID, [color, alpha, width, isVisibleInSecondaryCamera, enabled](ParabolaRenderItem& item) {
|
transaction.updateItem<ParabolaRenderItem>(_pathID, [color, alpha, width, isVisibleInSecondaryCamera, drawInFront, enabled](ParabolaRenderItem& item) {
|
||||||
item.setColor(color);
|
item.setColor(color);
|
||||||
item.setAlpha(alpha);
|
item.setAlpha(alpha);
|
||||||
item.setWidth(width);
|
item.setWidth(width);
|
||||||
item.setIsVisibleInSecondaryCamera(isVisibleInSecondaryCamera);
|
item.setIsVisibleInSecondaryCamera(isVisibleInSecondaryCamera);
|
||||||
|
item.setDrawInFront(drawInFront);
|
||||||
item.setEnabled(enabled);
|
item.setEnabled(enabled);
|
||||||
item.updateKey();
|
item.updateKey();
|
||||||
});
|
});
|
||||||
|
@ -200,6 +206,7 @@ std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVa
|
||||||
float alpha = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR.a;
|
float alpha = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR.a;
|
||||||
float width = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH;
|
float width = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH;
|
||||||
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
||||||
|
bool drawInFront = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_DRAWINFRONT;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
if (propMap["path"].isValid()) {
|
if (propMap["path"].isValid()) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -220,6 +227,10 @@ std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVa
|
||||||
if (pathMap["isVisibleInSecondaryCamera"].isValid()) {
|
if (pathMap["isVisibleInSecondaryCamera"].isValid()) {
|
||||||
isVisibleInSecondaryCamera = pathMap["isVisibleInSecondaryCamera"].toBool();
|
isVisibleInSecondaryCamera = pathMap["isVisibleInSecondaryCamera"].toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pathMap["drawInFront"].isValid()) {
|
||||||
|
drawInFront = pathMap["drawInFront"].toBool();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid endID;
|
QUuid endID;
|
||||||
|
@ -231,7 +242,7 @@ std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_shared<RenderState>(startID, endID, color, alpha, width, isVisibleInSecondaryCamera, enabled);
|
return std::make_shared<RenderState>(startID, endID, color, alpha, width, isVisibleInSecondaryCamera, drawInFront, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerEvent ParabolaPointer::buildPointerEvent(const PickedObject& target, const PickResultPointer& pickResult, const std::string& button, bool hover) {
|
PointerEvent ParabolaPointer::buildPointerEvent(const PickedObject& target, const PickResultPointer& pickResult, const std::string& button, bool hover) {
|
||||||
|
@ -283,8 +294,8 @@ glm::vec3 ParabolaPointer::findIntersection(const PickedObject& pickedObject, co
|
||||||
}
|
}
|
||||||
|
|
||||||
ParabolaPointer::RenderState::ParabolaRenderItem::ParabolaRenderItem(const glm::vec3& color, float alpha, float width,
|
ParabolaPointer::RenderState::ParabolaRenderItem::ParabolaRenderItem(const glm::vec3& color, float alpha, float width,
|
||||||
bool isVisibleInSecondaryCamera, bool enabled) :
|
bool isVisibleInSecondaryCamera, bool drawInFront, bool enabled) :
|
||||||
_isVisibleInSecondaryCamera(isVisibleInSecondaryCamera), _enabled(enabled)
|
_isVisibleInSecondaryCamera(isVisibleInSecondaryCamera), _drawInFront(drawInFront), _enabled(enabled)
|
||||||
{
|
{
|
||||||
_uniformBuffer->resize(sizeof(ParabolaData));
|
_uniformBuffer->resize(sizeof(ParabolaData));
|
||||||
setColor(color);
|
setColor(color);
|
||||||
|
@ -320,6 +331,10 @@ void ParabolaPointer::RenderState::ParabolaRenderItem::updateKey() {
|
||||||
builder.withTagBits(render::hifi::TAG_MAIN_VIEW);
|
builder.withTagBits(render::hifi::TAG_MAIN_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_drawInFront) {
|
||||||
|
builder.withLayer(render::hifi::LAYER_3D_FRONT);
|
||||||
|
}
|
||||||
|
|
||||||
_key = builder.build();
|
_key = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
using Pointer = Payload::DataPointer;
|
using Pointer = Payload::DataPointer;
|
||||||
|
|
||||||
ParabolaRenderItem(const glm::vec3& color, float alpha, float width,
|
ParabolaRenderItem(const glm::vec3& color, float alpha, float width,
|
||||||
bool isVisibleInSecondaryCamera, bool enabled);
|
bool isVisibleInSecondaryCamera, bool drawInFront, bool enabled);
|
||||||
~ParabolaRenderItem() {}
|
~ParabolaRenderItem() {}
|
||||||
|
|
||||||
static gpu::PipelinePointer _parabolaPipeline;
|
static gpu::PipelinePointer _parabolaPipeline;
|
||||||
|
@ -46,11 +46,13 @@ public:
|
||||||
void setAcceleration(const glm::vec3& acceleration) { _parabolaData.acceleration = acceleration; }
|
void setAcceleration(const glm::vec3& acceleration) { _parabolaData.acceleration = acceleration; }
|
||||||
void setOrigin(const glm::vec3& origin) { _origin = origin; }
|
void setOrigin(const glm::vec3& origin) { _origin = origin; }
|
||||||
void setIsVisibleInSecondaryCamera(const bool& isVisibleInSecondaryCamera) { _isVisibleInSecondaryCamera = isVisibleInSecondaryCamera; }
|
void setIsVisibleInSecondaryCamera(const bool& isVisibleInSecondaryCamera) { _isVisibleInSecondaryCamera = isVisibleInSecondaryCamera; }
|
||||||
|
void setDrawInFront(const bool& drawInFront) { _drawInFront = drawInFront; }
|
||||||
void setEnabled(const bool& enabled) { _enabled = enabled; }
|
void setEnabled(const bool& enabled) { _enabled = enabled; }
|
||||||
|
|
||||||
static const glm::vec4 DEFAULT_PARABOLA_COLOR;
|
static const glm::vec4 DEFAULT_PARABOLA_COLOR;
|
||||||
static const float DEFAULT_PARABOLA_WIDTH;
|
static const float DEFAULT_PARABOLA_WIDTH;
|
||||||
static const bool DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
static const bool DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
|
||||||
|
static const bool DEFAULT_PARABOLA_DRAWINFRONT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
render::Item::Bound _bound;
|
render::Item::Bound _bound;
|
||||||
|
@ -58,6 +60,7 @@ public:
|
||||||
|
|
||||||
glm::vec3 _origin { 0.0f };
|
glm::vec3 _origin { 0.0f };
|
||||||
bool _isVisibleInSecondaryCamera { DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA };
|
bool _isVisibleInSecondaryCamera { DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA };
|
||||||
|
bool _drawInFront { DEFAULT_PARABOLA_DRAWINFRONT };
|
||||||
bool _visible { false };
|
bool _visible { false };
|
||||||
bool _enabled { false };
|
bool _enabled { false };
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ public:
|
||||||
|
|
||||||
RenderState() {}
|
RenderState() {}
|
||||||
RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth,
|
RenderState(const OverlayID& startID, const OverlayID& endID, const glm::vec3& pathColor, float pathAlpha, float pathWidth,
|
||||||
bool isVisibleInSecondaryCamera, bool pathEnabled);
|
bool isVisibleInSecondaryCamera, bool drawInFront, bool pathEnabled);
|
||||||
|
|
||||||
void setPathWidth(float width) { _pathWidth = width; }
|
void setPathWidth(float width) { _pathWidth = width; }
|
||||||
float getPathWidth() const { return _pathWidth; }
|
float getPathWidth() const { return _pathWidth; }
|
||||||
|
@ -87,7 +90,7 @@ public:
|
||||||
void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY,
|
void update(const glm::vec3& origin, const glm::vec3& end, const glm::vec3& surfaceNormal, bool scaleWithAvatar, bool distanceScaleEnd, bool centerEndY,
|
||||||
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override;
|
bool faceAvatar, bool followNormal, float followNormalStrength, float distance, const PickResultPointer& pickResult) override;
|
||||||
|
|
||||||
void editParabola(const glm::vec3& color, float alpha, float width, bool isVisibleInSecondaryCamera, bool enabled);
|
void editParabola(const glm::vec3& color, float alpha, float width, bool isVisibleInSecondaryCamera, bool drawInFront, bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _pathID;
|
int _pathID;
|
||||||
|
|
|
@ -56,17 +56,20 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
var cancelPath = {
|
var cancelPath = {
|
||||||
color: COLORS_TELEPORT_CANCEL,
|
color: COLORS_TELEPORT_CANCEL,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
width: 0.025
|
width: 0.025,
|
||||||
|
drawInFront: true
|
||||||
};
|
};
|
||||||
var teleportPath = {
|
var teleportPath = {
|
||||||
color: COLORS_TELEPORT_CAN_TELEPORT,
|
color: COLORS_TELEPORT_CAN_TELEPORT,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
width: 0.025
|
width: 0.025,
|
||||||
|
drawInFront: true
|
||||||
};
|
};
|
||||||
var seatPath = {
|
var seatPath = {
|
||||||
color: COLORS_TELEPORT_SEAT,
|
color: COLORS_TELEPORT_SEAT,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
width: 0.025
|
width: 0.025,
|
||||||
|
drawInFront: true
|
||||||
};
|
};
|
||||||
var teleportEnd = {
|
var teleportEnd = {
|
||||||
type: "model",
|
type: "model",
|
||||||
|
|
Loading…
Reference in a new issue