fixed network bug for polylines

This commit is contained in:
ericrius1 2015-07-01 18:33:42 -07:00
parent ad54b4c0b0
commit 43b1751db3
2 changed files with 4 additions and 13 deletions

View file

@ -20,11 +20,6 @@
#include "RenderablePolyLineEntityItem.h"
EntityItemPointer RenderablePolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return EntityItemPointer(new RenderablePolyLineEntityItem(entityID, properties));
}
@ -65,9 +60,9 @@ int generateColor() {
float c1 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
float c2 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
float c3 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
return ((int(c1 * 255.0f) & 0xFF)) |
((int(c2 * 255.0f) & 0xFF) << 8) |
((int(c3 * 255.0f) & 0xFF) << 16) |
return ((int(0.7 * 255.0f) & 0xFF)) |
((int(0.3 * 255.0f) & 0xFF) << 8) |
((int(0.6 * 255.0f) & 0xFF) << 16) |
((int(255.0f) & 0xFF) << 24);
}
@ -78,7 +73,6 @@ void RenderablePolyLineEntityItem::updateGeometry() {
_verticesBuffer.reset(new gpu::Buffer());
int vertexIndex = 0;
for (int i = 0; i < _normals.size(); i++) {
compactColor = generateColor();
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_vertices.at(vertexIndex));
vertexIndex++;
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_normals.at(i));
@ -92,12 +86,8 @@ void RenderablePolyLineEntityItem::updateGeometry() {
}
_pointsChanged = false;
}
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
if (_points.size() < 2 || _vertices.size() != _normals.size() * 2) {
return;

View file

@ -629,6 +629,7 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto
dataBytes += sizeof(length);
result.resize(length);
memcpy(result.data(), dataBytes, length * sizeof(float));
return sizeof(uint16_t) + length * sizeof(float);
}
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QByteArray& result) {