line entity width translating

This commit is contained in:
Eric Levin 2015-05-29 09:24:00 -07:00
parent 3627f03c0d
commit f573645291
5 changed files with 21 additions and 8 deletions

View file

@ -41,7 +41,12 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
glTranslatef(position.x, position.y, position.z);
glm::vec3 axis = glm::axis(rotation);
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
QVector<glm::vec3> points;
glm::vec3 p1 = {0, 0, 0};
glm::vec3 p2 = {1, 1, 0};
points<<p1<<p2;
// geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
geometryCache->updateVertices(_lineVerticesID, points, lineColor);
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
glPopMatrix();

View file

@ -753,8 +753,9 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
}
if(properties.getType() == EntityTypes::Line){
qDebug()<<"****** LINE WIDTH!!!!!!!!!!!!!!! **********" << properties.getLineWidth();
APPEND_ENTITY_PROPERTY(PROP_LINE_WIDTH, properties.getLineWidth());
APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints());
// APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints());
}
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, properties.getMarketplaceID());
@ -992,8 +993,10 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
}
if(properties.getType() == EntityTypes::Line) {
qDebug()<<"READING LINE ENTITY";
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
qDebug()<<"width: "<< properties._lineWidth;
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
}
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_MARKETPLACE_ID, QString, setMarketplaceID);
@ -1100,6 +1103,8 @@ void EntityItemProperties::markAllChanged() {
_skybox.markAllChanged();
_sourceUrlChanged = true;
_lineWidthChanged = true;
}
/// The maximum bounding cube for the entity, independent of it's rotation.

View file

@ -141,7 +141,7 @@ public:
DEFINE_PROPERTY_GROUP(Atmosphere, atmosphere, AtmospherePropertyGroup);
DEFINE_PROPERTY_GROUP(Skybox, skybox, SkyboxPropertyGroup);
DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString);
DEFINE_PROPERTY(LINE_WIDTH, LineWidth, lineWidth, float);
DEFINE_PROPERTY(PROP_LINE_WIDTH, LineWidth, lineWidth, float);
DEFINE_PROPERTY_REF(LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>);
static QString getBackgroundModeString(BackgroundMode mode);

View file

@ -42,13 +42,16 @@ LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityIte
}
EntityItemProperties LineEntityItem::getProperties() const {
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineWidth, getLineWidth);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(linePoints, getLinePoints);
properties._color = getXColor();
properties._colorChanged = false;
properties._lineWidth = getLineWidth();
properties._lineWidthChanged = false;
properties._glowLevel = getGlowLevel();
@ -60,7 +63,7 @@ EntityItemProperties LineEntityItem::getProperties() const {
bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
bool somethingChanged = false;
somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
SET_ENTITY_PROPERTY_FROM_PROPERTIES(color, setColor);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lineWidth, setLineWidth);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(linePoints, setLinePoints);
@ -88,7 +91,7 @@ int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
READ_ENTITY_PROPERTY(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
// READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
return bytesRead;
@ -99,6 +102,7 @@ int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
EntityPropertyFlags LineEntityItem::getEntityProperties(EncodeBitstreamParams& params) const {
EntityPropertyFlags requestedProperties = EntityItem::getEntityProperties(params);
requestedProperties += PROP_COLOR;
requestedProperties += PROP_LINE_WIDTH;
return requestedProperties;
}

View file

@ -52,7 +52,6 @@ class LineEntityItem : public EntityItem {
}
void setLineWidth(float lineWidth){
_lineWidth = lineWidth;
}
float getLineWidth() const{