mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 20:30:29 +02:00
using vec of points
This commit is contained in:
parent
8edc883e4d
commit
385c9be75f
3 changed files with 14 additions and 11 deletions
|
@ -41,16 +41,8 @@ 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);
|
||||
|
||||
bool geometryChanged = true;
|
||||
if(geometryChanged){
|
||||
QVector<glm::vec3> points;
|
||||
glm::vec3 p1 = {0.0f, 0.0f, 0.0f};
|
||||
glm::vec3 p2 = dimensions;
|
||||
points << p1;
|
||||
points << p2;
|
||||
geometryCache->updateVertices(_lineVerticesID, points, lineColor);
|
||||
}
|
||||
geometryCache->updateVertices(_lineVerticesID, getPoints(), lineColor);
|
||||
|
||||
geometryCache->renderVertices(gpu::LINES, _lineVerticesID);
|
||||
glPopMatrix();
|
||||
RenderableDebugableEntityItem::render(this, args);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
const float LineEntityItem::DEFAULT_LINE_WIDTH = 2.0f;
|
||||
|
||||
|
||||
EntityItem* LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
EntityItem* result = new LineEntityItem(entityID, properties);
|
||||
return result;
|
||||
|
@ -29,11 +30,16 @@ EntityItem* LineEntityItem::factory(const EntityItemID& entityID, const EntityIt
|
|||
|
||||
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
EntityItem(entityItemID) ,
|
||||
_lineWidth(DEFAULT_LINE_WIDTH)
|
||||
_lineWidth(DEFAULT_LINE_WIDTH),
|
||||
_points(QVector<glm::vec3>(100))
|
||||
{
|
||||
_type = EntityTypes::Line;
|
||||
_created = properties.getCreated();
|
||||
setProperties(properties);
|
||||
glm::vec3 p1 = {0.0f, 0.0f, 0.0f};
|
||||
glm::vec3 p2 = {1.0f, 1.0f, 0.0f};
|
||||
_points << p1;
|
||||
_points << p2;
|
||||
}
|
||||
|
||||
EntityItemProperties LineEntityItem::getProperties() const {
|
||||
|
|
|
@ -60,6 +60,10 @@ class LineEntityItem : public EntityItem {
|
|||
return _lineWidth;
|
||||
}
|
||||
|
||||
QVector<glm::vec3> getPoints() const{
|
||||
return _points;
|
||||
}
|
||||
|
||||
virtual ShapeType getShapeType() const { return SHAPE_TYPE_LINE; }
|
||||
|
||||
// never have a ray intersection pick a LineEntityItem.
|
||||
|
@ -74,6 +78,7 @@ class LineEntityItem : public EntityItem {
|
|||
protected:
|
||||
rgbColor _color;
|
||||
float _lineWidth;
|
||||
QVector<glm::vec3> _points;
|
||||
};
|
||||
|
||||
#endif // hifi_LineEntityItem_h
|
||||
|
|
Loading…
Reference in a new issue