code style changes

This commit is contained in:
Eric Levin 2015-06-02 12:51:45 -07:00
parent e7c5a24e3d
commit 55ffb7f1c0
6 changed files with 12 additions and 17 deletions

View file

@ -41,7 +41,7 @@ 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;
if(_pointsChanged) {
if (_pointsChanged) {
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
_pointsChanged = false;
}

View file

@ -96,7 +96,7 @@ CONSTRUCT_PROPERTY(name, ENTITY_ITEM_DEFAULT_NAME),
CONSTRUCT_PROPERTY(backgroundMode, BACKGROUND_MODE_INHERIT),
CONSTRUCT_PROPERTY(sourceUrl, ""),
CONSTRUCT_PROPERTY(lineWidth, LineEntityItem::DEFAULT_LINE_WIDTH),
CONSTRUCT_PROPERTY(linePoints, 0),
CONSTRUCT_PROPERTY(linePoints, QVector<glm::vec3>()),
_id(UNKNOWN_ENTITY_ID),
@ -769,7 +769,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
APPEND_ENTITY_PROPERTY(PROP_VOXEL_SURFACE_STYLE, properties.getVoxelSurfaceStyle());
}
if(properties.getType() == EntityTypes::Line){
if (properties.getType() == EntityTypes::Line) {
APPEND_ENTITY_PROPERTY(PROP_LINE_WIDTH, properties.getLineWidth());
APPEND_ENTITY_PROPERTY(PROP_LINE_POINTS, properties.getLinePoints());
}
@ -1014,7 +1014,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VOXEL_SURFACE_STYLE, uint16_t, setVoxelSurfaceStyle);
}
if(properties.getType() == EntityTypes::Line) {
if (properties.getType() == EntityTypes::Line) {
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
}

View file

@ -169,7 +169,7 @@ inline glmVec3 glmVec3_convertFromScriptValue(const QScriptValue& v, bool& isVal
return glm::vec3(0);
}
inline qVectorVec3 qVectorVec3_convertFromScriptValue(const QScriptValue& v, bool& isValid){
inline qVectorVec3 qVectorVec3_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
isValid = true;
return qVectorVec3FromScriptValue(v);
}

View file

@ -50,8 +50,8 @@ EntityItemProperties LineEntityItem::getProperties() const {
properties._color = getXColor();
properties._colorChanged = false;
properties._lineWidth = getLineWidth();
properties._lineWidthChanged = false;
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lineWidth, getLineWidth);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(linePoints, getLinePoints);

View file

@ -383,14 +383,9 @@ bool OctreePacketData::appendValue(const glm::vec3& value) {
bool OctreePacketData::appendValue(const QVector<glm::vec3>& value) {
uint16_t qVecSize = value.size();
uint16_t sizeLength = sizeof(qVecSize);
bool success = append((const unsigned char*)&qVecSize, sizeLength);
if(success){
_bytesOfValues += sizeLength;
_totalBytesOfValues += sizeLength;
}
bool success = appendValue(qVecSize);
success = append((const unsigned char*)value.constData(), qVecSize * sizeof(glm::vec3));
if(success){
if (success) {
_bytesOfValues += qVecSize * sizeof(glm::vec3);
_totalBytesOfValues += qVecSize * sizeof(glm::vec3);
}

View file

@ -75,17 +75,17 @@ 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++){
for (int i = 0; i < vector.size(); i++) {
array.setProperty(i, vec3toScriptValue(engine, vector.at(i)));
}
return array;
}
QVector<glm::vec3> qVectorVec3FromScriptValue(const QScriptValue& array){
QVector<glm::vec3> newVector(0);
QVector<glm::vec3> newVector;
int length = array.property("length").toInteger();
for(int i = 0; i < length; i++) {
for (int i = 0; i < length; i++) {
glm::vec3 newVec3 = glm::vec3();
vec3FromScriptValue(array.property(i), newVec3);
newVector << newVec3;