mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 16:30:10 +02:00
adding flag for points changed
This commit is contained in:
parent
9ca5310c21
commit
8a191a661d
3 changed files with 14 additions and 6 deletions
|
@ -41,7 +41,10 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
|
|||
glm::vec3 axis = glm::axis(rotation);
|
||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||
QVector<glm::vec3> points;
|
||||
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
||||
if(_pointsChanged){
|
||||
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
||||
_pointsChanged = false;
|
||||
}
|
||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||
glPopMatrix();
|
||||
RenderableDebugableEntityItem::render(this, args);
|
||||
|
|
|
@ -32,7 +32,8 @@ EntityItem* LineEntityItem::factory(const EntityItemID& entityID, const EntityIt
|
|||
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
EntityItem(entityItemID) ,
|
||||
_lineWidth(DEFAULT_LINE_WIDTH),
|
||||
_points(QVector<glm::vec3>(0))
|
||||
_points(QVector<glm::vec3>(0)),
|
||||
_pointsChanged(true)
|
||||
{
|
||||
_type = EntityTypes::Line;
|
||||
_created = properties.getCreated();
|
||||
|
@ -83,7 +84,12 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
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,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) {
|
||||
|
||||
|
|
|
@ -59,9 +59,7 @@ class LineEntityItem : public EntityItem {
|
|||
return _lineWidth;
|
||||
}
|
||||
|
||||
void setLinePoints(const QVector<glm::vec3>& points){
|
||||
_points = points;
|
||||
}
|
||||
void setLinePoints(const QVector<glm::vec3>& points);
|
||||
|
||||
const QVector<glm::vec3>& getLinePoints() const{
|
||||
return _points;
|
||||
|
@ -81,6 +79,7 @@ class LineEntityItem : public EntityItem {
|
|||
protected:
|
||||
rgbColor _color;
|
||||
float _lineWidth;
|
||||
bool _pointsChanged;
|
||||
QVector<glm::vec3> _points;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue