adding flag for points changed

This commit is contained in:
Eric Levin 2015-06-01 09:35:32 -07:00
parent 9ca5310c21
commit 8a191a661d
3 changed files with 14 additions and 6 deletions

View file

@ -41,7 +41,10 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
glm::vec3 axis = glm::axis(rotation); glm::vec3 axis = glm::axis(rotation);
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
QVector<glm::vec3> points; QVector<glm::vec3> points;
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor); if(_pointsChanged){
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
_pointsChanged = false;
}
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID); geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
glPopMatrix(); glPopMatrix();
RenderableDebugableEntityItem::render(this, args); RenderableDebugableEntityItem::render(this, args);

View file

@ -32,7 +32,8 @@ EntityItem* LineEntityItem::factory(const EntityItemID& entityID, const EntityIt
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID) , EntityItem(entityItemID) ,
_lineWidth(DEFAULT_LINE_WIDTH), _lineWidth(DEFAULT_LINE_WIDTH),
_points(QVector<glm::vec3>(0)) _points(QVector<glm::vec3>(0)),
_pointsChanged(true)
{ {
_type = EntityTypes::Line; _type = EntityTypes::Line;
_created = properties.getCreated(); _created = properties.getCreated();
@ -83,7 +84,12 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
return somethingChanged; return somethingChanged;
} }
int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, void LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
_points = points;
_pointsChanged = true;
}
int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData) {

View file

@ -59,9 +59,7 @@ class LineEntityItem : public EntityItem {
return _lineWidth; return _lineWidth;
} }
void setLinePoints(const QVector<glm::vec3>& points){ void setLinePoints(const QVector<glm::vec3>& points);
_points = points;
}
const QVector<glm::vec3>& getLinePoints() const{ const QVector<glm::vec3>& getLinePoints() const{
return _points; return _points;
@ -81,6 +79,7 @@ class LineEntityItem : public EntityItem {
protected: protected:
rgbColor _color; rgbColor _color;
float _lineWidth; float _lineWidth;
bool _pointsChanged;
QVector<glm::vec3> _points; QVector<glm::vec3> _points;
}; };