mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 06:17:46 +02:00
line working from array of points
This commit is contained in:
parent
8886e93d5f
commit
2d66696675
4 changed files with 19 additions and 10 deletions
|
@ -24,6 +24,7 @@ EntityItem* RenderableLineEntityItem::factory(const EntityItemID& entityID, cons
|
|||
}
|
||||
|
||||
void RenderableLineEntityItem::render(RenderArgs* args) {
|
||||
qDebug()<<"RENDER";
|
||||
PerformanceTimer perfTimer("RenderableLineEntityItem::render");
|
||||
assert(getType() == EntityTypes::Line);
|
||||
glm::vec3 position = getPosition();
|
||||
|
|
|
@ -32,12 +32,10 @@ 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>(5))
|
||||
_points(QVector<glm::vec3>(0))
|
||||
{
|
||||
_type = EntityTypes::Line;
|
||||
_created = properties.getCreated();
|
||||
glm::vec3 p1 = {0.0f, 0.0f, 0.0f};
|
||||
glm::vec3 p2 = {1.0f, 1.0f, 0.0f};
|
||||
setProperties(properties);
|
||||
|
||||
|
||||
|
@ -65,10 +63,9 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(color, setColor);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lineWidth, setLineWidth);
|
||||
qDebug()<<"LINE POINTS" << properties._linePoints.size();
|
||||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(linePoints, setLinePoints);
|
||||
|
||||
|
||||
if (somethingChanged) {
|
||||
bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
|
|
|
@ -62,8 +62,13 @@ class LineEntityItem : public EntityItem {
|
|||
|
||||
|
||||
void setLinePoints(const QVector<glm::vec3>& points){
|
||||
qDebug()<<"WE ARE SETTTTING POINTS *******************";
|
||||
qDebug()<<"points " << points;
|
||||
_points = points;
|
||||
// _points = QVector<glm::vec3>(0);
|
||||
// glm::vec3 p1 = { 0,0,0};
|
||||
// glm::vec3 p2 = {1, 1,0};
|
||||
// _points <<p1;
|
||||
// _points<< p2;
|
||||
}
|
||||
|
||||
const QVector<glm::vec3>& getLinePoints() const{
|
||||
|
|
|
@ -75,15 +75,21 @@ void vec3FromScriptValue(const QScriptValue &object, glm::vec3 &vec3) {
|
|||
QScriptValue qVectorVec3ToScriptValue(QScriptEngine* engine, const QVector<glm::vec3> &vector){
|
||||
QScriptValue array = engine->newArray();
|
||||
for(int i = 0; i < vector.size(); i++){
|
||||
array.setProperty(i, vec3toScriptValue(vector.at(i)));
|
||||
array.setProperty(i, vec3toScriptValue(engine, vector.at(i)));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
QVector<glm::vec3> qVectorVec3FromScriptValue(const QScriptValue &array){
|
||||
QVector<glm:vec3> newVector;
|
||||
qDebug()<<"Point 2 x"<<array.property(1).property("y").toString();
|
||||
return QVector<glm::vec3>(8);
|
||||
QVector<glm::vec3> newVector(0);
|
||||
int length = array.property("length").toInteger();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
glm::vec3 newVec3 = glm::vec3();
|
||||
vec3FromScriptValue(array.property(i), newVec3);
|
||||
newVector << newVec3;
|
||||
}
|
||||
return newVector;
|
||||
}
|
||||
|
||||
QScriptValue vec2toScriptValue(QScriptEngine* engine, const glm::vec2 &vec2) {
|
||||
|
|
Loading…
Reference in a new issue