mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Added faceCamera property to Text Entities
…and removed from base
This commit is contained in:
parent
0516caaa32
commit
aa865680ab
12 changed files with 61 additions and 29 deletions
|
@ -76,13 +76,16 @@ _geometry(geometry)
|
|||
connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));
|
||||
}
|
||||
}
|
||||
|
||||
_printButton = new QPushButton(tr("&Print Mapping"));
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Cancel | QDialogButtonBox::Reset);
|
||||
buttons->addButton(_printButton, QDialogButtonBox::ActionRole);
|
||||
connect(buttons, SIGNAL(accepted()), SLOT(accept()));
|
||||
connect(buttons, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(buttons->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), SLOT(reset()));
|
||||
|
||||
connect(_printButton, SIGNAL(clicked(bool)), SLOT(printJointMapping()));
|
||||
|
||||
form->addRow(buttons);
|
||||
|
||||
// reset to initialize the fields
|
||||
|
@ -146,8 +149,29 @@ QVariantHash ModelPropertiesDialog::getMapping() const {
|
|||
}
|
||||
|
||||
return mapping;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ModelPropertiesDialog::printJointMapping() const {
|
||||
QVariantHash jointHash = getMapping();
|
||||
QHashIterator<QString, QVariant> i(getMapping());
|
||||
qDebug() << "STARTING...";
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
if(i.key() == "joint" || i.key() == "jointIndex") {
|
||||
QHashIterator<QString, QVariant> j(i.value().toHash());
|
||||
while(j.hasNext()) {
|
||||
j.next();
|
||||
qDebug() << j.key() << ": " << j.value().toString();
|
||||
}
|
||||
} else {
|
||||
qDebug() << i.key() << ": " << i.value().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void setJointText(QComboBox* box, const QString& text) {
|
||||
box->setCurrentIndex(qMax(box->findText(text), 0));
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ private slots:
|
|||
void chooseTextureDirectory();
|
||||
void updatePivotJoint();
|
||||
void createNewFreeJoint(const QString& joint = QString());
|
||||
void printJointMapping() const;
|
||||
|
||||
private:
|
||||
QComboBox* createJointBox(bool withNone = true) const;
|
||||
|
@ -52,6 +53,7 @@ private:
|
|||
FBXGeometry _geometry;
|
||||
QLineEdit* _name = nullptr;
|
||||
QPushButton* _textureDirectory = nullptr;
|
||||
QPushButton* _printButton = nullptr;
|
||||
QDoubleSpinBox* _scale = nullptr;
|
||||
QDoubleSpinBox* _translationX = nullptr;
|
||||
QDoubleSpinBox* _translationY = nullptr;
|
||||
|
|
|
@ -44,18 +44,18 @@ void RenderableTextEntityItem::render(RenderArgs* args) {
|
|||
glm::vec3 minCorner = glm::vec3(0.0f, -dimensions.y, SLIGHTLY_BEHIND);
|
||||
glm::vec3 maxCorner = glm::vec3(dimensions.x, 0.0f, SLIGHTLY_BEHIND);
|
||||
|
||||
// rotate about vertical to face the camera
|
||||
if (getBillboarded()) {
|
||||
glm::vec3 position = minCorner;
|
||||
glm::quat rotation = args->_viewFrustum->getOrientation();
|
||||
transformToTopLeft.setRotation(rotation);
|
||||
}
|
||||
|
||||
|
||||
// Batch render calls
|
||||
Q_ASSERT(args->_batch);
|
||||
gpu::Batch& batch = *args->_batch;
|
||||
batch.setModelTransform(transformToTopLeft);
|
||||
|
||||
//rotate about vertical to face the camera
|
||||
if (getFaceCamera()) {
|
||||
transformToTopLeft.postRotate(args->_viewFrustum->getOrientation());
|
||||
batch.setModelTransform(transformToTopLeft);
|
||||
}
|
||||
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderQuad(batch, minCorner, maxCorner, backgroundColor);
|
||||
|
||||
float scale = _lineHeight / _textRenderer->getFontSize();
|
||||
|
|
|
@ -69,7 +69,6 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
|||
_name(ENTITY_ITEM_DEFAULT_NAME),
|
||||
_href(""),
|
||||
_description(""),
|
||||
_billBoarded(false),
|
||||
_dirtyFlags(0),
|
||||
_element(nullptr),
|
||||
_physicsInfo(nullptr),
|
||||
|
@ -122,7 +121,6 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
|||
requestedProperties += PROP_SIMULATOR_ID;
|
||||
requestedProperties += PROP_HREF;
|
||||
requestedProperties += PROP_DESCRIPTION;
|
||||
requestedProperties += PROP_BILLBOARDED;
|
||||
|
||||
return requestedProperties;
|
||||
}
|
||||
|
@ -919,7 +917,6 @@ EntityItemProperties EntityItem::getProperties() const {
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(name, getName);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(billBoarded, getBillboarded);
|
||||
|
||||
properties._defaultSettings = false;
|
||||
|
||||
|
@ -980,7 +977,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(billBoarded, setBillboarded);
|
||||
|
||||
if (somethingChanged) {
|
||||
uint64_t now = usecTimestampNow();
|
||||
|
|
|
@ -314,9 +314,6 @@ public:
|
|||
const QString& getUserData() const { return _userData; }
|
||||
void setUserData(const QString& value) { _userData = value; }
|
||||
|
||||
bool getBillboarded() const { return _billBoarded; }
|
||||
void setBillboarded(bool value) { _billBoarded = value; }
|
||||
|
||||
QUuid getSimulatorID() const { return _simulatorID; }
|
||||
void setSimulatorID(const QUuid& value);
|
||||
void updateSimulatorID(const QUuid& value);
|
||||
|
@ -430,7 +427,6 @@ protected:
|
|||
QString _name;
|
||||
QString _href; //Hyperlink href
|
||||
QString _description; //Hyperlink description
|
||||
bool _billBoarded;
|
||||
|
||||
// NOTE: Damping is applied like this: v *= pow(1 - damping, dt)
|
||||
//
|
||||
|
|
|
@ -98,7 +98,7 @@ CONSTRUCT_PROPERTY(backgroundMode, BACKGROUND_MODE_INHERIT),
|
|||
CONSTRUCT_PROPERTY(sourceUrl, ""),
|
||||
CONSTRUCT_PROPERTY(lineWidth, LineEntityItem::DEFAULT_LINE_WIDTH),
|
||||
CONSTRUCT_PROPERTY(linePoints, QVector<glm::vec3>()),
|
||||
CONSTRUCT_PROPERTY(billBoarded, ENTITY_ITEM_DEFAULT_BILLBOARDED),
|
||||
CONSTRUCT_PROPERTY(faceCamera, TextEntityItem::DEFAULT_FACE_CAMERA),
|
||||
|
||||
|
||||
_id(UNKNOWN_ENTITY_ID),
|
||||
|
@ -350,7 +350,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints);
|
||||
CHECK_PROPERTY_CHANGE(PROP_HREF, href);
|
||||
CHECK_PROPERTY_CHANGE(PROP_DESCRIPTION, description);
|
||||
CHECK_PROPERTY_CHANGE(PROP_BILLBOARDED, billBoarded);
|
||||
CHECK_PROPERTY_CHANGE(PROP_FACE_CAMERA, faceCamera);
|
||||
|
||||
changedProperties += _stage.getChangedProperties();
|
||||
changedProperties += _atmosphere.getChangedProperties();
|
||||
|
@ -446,7 +446,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE(linePoints);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(href);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(description);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(billBoarded);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(faceCamera);
|
||||
|
||||
// Sitting properties support
|
||||
if (!skipDefaults) {
|
||||
|
@ -558,7 +558,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
|||
COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(href, QString, setHref);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(description, QString, setDescription);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(billBoarded, bool, setBillboarded);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(faceCamera, bool, setFaceCamera);
|
||||
|
||||
if (!honorReadOnly) {
|
||||
// this is used by the json reader to set things that we don't want javascript to able to affect.
|
||||
|
@ -725,7 +725,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
|||
APPEND_ENTITY_PROPERTY(PROP_SIMULATOR_ID, properties.getSimulatorID());
|
||||
APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref());
|
||||
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, properties.getDescription());
|
||||
APPEND_ENTITY_PROPERTY(PROP_BILLBOARDED, properties.getBillboarded());
|
||||
|
||||
|
||||
if (properties.getType() == EntityTypes::Web) {
|
||||
APPEND_ENTITY_PROPERTY(PROP_SOURCE_URL, properties.getSourceUrl());
|
||||
|
@ -736,6 +736,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
|||
APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, properties.getLineHeight());
|
||||
APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, properties.getTextColor());
|
||||
APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, properties.getBackgroundColor());
|
||||
APPEND_ENTITY_PROPERTY(PROP_FACE_CAMERA, properties.getFaceCamera());
|
||||
}
|
||||
|
||||
if (properties.getType() == EntityTypes::Model) {
|
||||
|
@ -978,7 +979,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
|||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SIMULATOR_ID, QUuid, setSimulatorID);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DESCRIPTION, QString, setDescription);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BILLBOARDED, bool, setBillboarded);
|
||||
|
||||
|
||||
if (properties.getType() == EntityTypes::Web) {
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SOURCE_URL, QString, setSourceUrl);
|
||||
|
@ -989,6 +990,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
|||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_HEIGHT, float, setLineHeight);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT_COLOR, xColor, setTextColor);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_COLOR, xColor, setBackgroundColor);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_FACE_CAMERA, bool, setFaceCamera);
|
||||
}
|
||||
|
||||
if (properties.getType() == EntityTypes::Model) {
|
||||
|
@ -1167,7 +1169,7 @@ void EntityItemProperties::markAllChanged() {
|
|||
_hrefChanged = true;
|
||||
_descriptionChanged = true;
|
||||
|
||||
_billBoardedChanged = true;
|
||||
_faceCameraChanged = true;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
DEFINE_PROPERTY_REF(LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>);
|
||||
DEFINE_PROPERTY_REF(PROP_HREF, Href, href, QString);
|
||||
DEFINE_PROPERTY_REF(PROP_DESCRIPTION, Description, description, QString);
|
||||
DEFINE_PROPERTY(PROP_BILLBOARDED, Billboarded, billBoarded, bool);
|
||||
DEFINE_PROPERTY(PROP_FACE_CAMERA, FaceCamera, faceCamera, bool);
|
||||
|
||||
static QString getBackgroundModeString(BackgroundMode mode);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ enum EntityPropertyList {
|
|||
PROP_HREF,
|
||||
PROP_DESCRIPTION,
|
||||
|
||||
PROP_BILLBOARDED,
|
||||
PROP_FACE_CAMERA,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ATTENTION: add new properties ABOVE this line
|
||||
|
|
|
@ -27,6 +27,7 @@ const QString TextEntityItem::DEFAULT_TEXT("");
|
|||
const float TextEntityItem::DEFAULT_LINE_HEIGHT = 0.1f;
|
||||
const xColor TextEntityItem::DEFAULT_TEXT_COLOR = { 255, 255, 255 };
|
||||
const xColor TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0};
|
||||
const bool TextEntityItem::DEFAULT_FACE_CAMERA = false;
|
||||
|
||||
EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new TextEntityItem(entityID, properties));
|
||||
|
@ -54,6 +55,7 @@ EntityItemProperties TextEntityItem::getProperties() const {
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineHeight, getLineHeight);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textColor, getTextColorX);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundColor, getBackgroundColorX);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(faceCamera, getFaceCamera);
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
@ -65,6 +67,7 @@ bool TextEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lineHeight, setLineHeight);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textColor, setTextColor);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(backgroundColor, setBackgroundColor);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(faceCamera, setFaceCamera);
|
||||
|
||||
if (somethingChanged) {
|
||||
bool wantDebug = false;
|
||||
|
@ -91,7 +94,8 @@ int TextEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
|||
READ_ENTITY_PROPERTY(PROP_LINE_HEIGHT, float, setLineHeight);
|
||||
READ_ENTITY_PROPERTY(PROP_TEXT_COLOR, rgbColor, setTextColor);
|
||||
READ_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, rgbColor, setBackgroundColor);
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_FACE_CAMERA, bool, setFaceCamera);
|
||||
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
|
@ -103,6 +107,7 @@ EntityPropertyFlags TextEntityItem::getEntityProperties(EncodeBitstreamParams& p
|
|||
requestedProperties += PROP_LINE_HEIGHT;
|
||||
requestedProperties += PROP_TEXT_COLOR;
|
||||
requestedProperties += PROP_BACKGROUND_COLOR;
|
||||
requestedProperties += PROP_FACE_CAMERA;
|
||||
return requestedProperties;
|
||||
}
|
||||
|
||||
|
@ -120,6 +125,8 @@ void TextEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
|||
APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, getLineHeight());
|
||||
APPEND_ENTITY_PROPERTY(PROP_TEXT_COLOR, getTextColor());
|
||||
APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_COLOR, getBackgroundColor());
|
||||
APPEND_ENTITY_PROPERTY(PROP_FACE_CAMERA, getFaceCamera());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,12 +79,17 @@ public:
|
|||
_backgroundColor[GREEN_INDEX] = value.green;
|
||||
_backgroundColor[BLUE_INDEX] = value.blue;
|
||||
}
|
||||
|
||||
static const bool DEFAULT_FACE_CAMERA;
|
||||
bool getFaceCamera() const { return _faceCamera; }
|
||||
void setFaceCamera(bool value) { _faceCamera = value; }
|
||||
|
||||
protected:
|
||||
QString _text;
|
||||
float _lineHeight;
|
||||
rgbColor _textColor;
|
||||
rgbColor _backgroundColor;
|
||||
bool _faceCamera;
|
||||
};
|
||||
|
||||
#endif // hifi_TextEntityItem_h
|
||||
|
|
|
@ -73,7 +73,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
|||
case PacketTypeEntityAdd:
|
||||
case PacketTypeEntityEdit:
|
||||
case PacketTypeEntityData:
|
||||
return VERSION_ENTITIES_BILLBOARDED;
|
||||
return VERSION_ENTITIES_FACE_CAMERA;
|
||||
case PacketTypeEntityErase:
|
||||
return 2;
|
||||
case PacketTypeAudioStreamStats:
|
||||
|
|
|
@ -183,6 +183,6 @@ const PacketVersion VERSION_ENTITIES_HAVE_FRICTION = 26;
|
|||
const PacketVersion VERSION_NO_ENTITY_ID_SWAP = 27;
|
||||
const PacketVersion VERSION_ENTITIES_PARTICLE_FIX = 28;
|
||||
const PacketVersion VERSION_ENTITIES_LINE_POINTS = 29;
|
||||
const PacketVersion VERSION_ENTITIES_BILLBOARDED = 30;
|
||||
const PacketVersion VERSION_ENTITIES_FACE_CAMERA = 30;
|
||||
|
||||
#endif // hifi_PacketHeaders_h
|
||||
|
|
Loading…
Reference in a new issue