mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 05:53:06 +02:00
cleaned up logging and testing code.
This commit is contained in:
parent
27b59b5f72
commit
115bf3dd25
4 changed files with 2 additions and 72 deletions
|
@ -31,10 +31,8 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
|
|||
glm::quat rotation = getRotation();
|
||||
glm::vec4 lineColor(toGlm(getXColor()), getLocalRenderAlpha());
|
||||
glPushMatrix();
|
||||
|
||||
glLineWidth(getLineWidth());
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
if(_lineVerticesID == GeometryCache::UNKNOWN_ID){
|
||||
_lineVerticesID = geometryCache ->allocateID();
|
||||
}
|
||||
|
@ -42,13 +40,8 @@ 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;
|
||||
glm::vec3 p1 = {0, 0, 0};
|
||||
glm::vec3 p2 = {1, 1, 0};
|
||||
points<<p1<<p2;
|
||||
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
||||
// geometryCache->updateVertices(_lineVerticesID, points, lineColor);
|
||||
|
||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||
glPopMatrix();
|
||||
RenderableDebugableEntityItem::render(this, args);
|
||||
};
|
||||
|
|
|
@ -59,17 +59,9 @@ class LineEntityItem : public EntityItem {
|
|||
return _lineWidth;
|
||||
}
|
||||
|
||||
|
||||
void setLinePoints(const QVector<glm::vec3>& points){
|
||||
qDebug()<<"points " << points;
|
||||
_points = points;
|
||||
// _points = QVector<glm::vec3>(0);
|
||||
// glm::vec3 p1 = { 0,0,0};
|
||||
// glm::vec3 p2 = {1, -1,2};
|
||||
// glm::vec3 p3 = {4, 0, 0};
|
||||
// _points <<p1;
|
||||
// _points<< p2;
|
||||
// _points<<p3;
|
||||
}
|
||||
|
||||
const QVector<glm::vec3>& getLinePoints() const{
|
||||
|
|
|
@ -362,7 +362,6 @@ bool OctreePacketData::appendValue(float value) {
|
|||
|
||||
const unsigned char* data = (const unsigned char*)&value;
|
||||
int length = sizeof(value);
|
||||
qDebug()<<"Line Width Value!**"<<value;
|
||||
bool success = append(data, length);
|
||||
if (success) {
|
||||
_bytesOfValues += length;
|
||||
|
@ -383,70 +382,22 @@ bool OctreePacketData::appendValue(const glm::vec3& value) {
|
|||
}
|
||||
|
||||
bool OctreePacketData::appendValue(const QVector<glm::vec3>& value){
|
||||
|
||||
// const unsigned char* data = (const unsigned char*)value.data();
|
||||
// uint16_t qVecSize = (uint16_t)value.size();
|
||||
//
|
||||
// int length = qVecSize * sizeof(glm::vec3);
|
||||
// const unsigned char* sizePointer = (const unsigned char*)&qVecSize;
|
||||
// bool success = append(sizePointer, sizeof(uint16_t));
|
||||
// if(success){
|
||||
// _bytesOfValues += qVecSize;
|
||||
// _totalBytesOfValues += qVecSize;
|
||||
// success = append(data, length);
|
||||
// if (success){
|
||||
// _bytesOfValues += length;
|
||||
// _totalBytesOfValues += length;
|
||||
// }
|
||||
// }
|
||||
// return success;
|
||||
|
||||
// const unsigned char* data = (const unsigned char*)value.data();
|
||||
// int qVecSize = value.size();
|
||||
//
|
||||
// int length = qVecSize * sizeof(glm::vec3);
|
||||
//
|
||||
// bool success = append(data, length);
|
||||
// if (success){
|
||||
// _bytesOfValues += length;
|
||||
// _totalBytesOfValues += length;
|
||||
// }
|
||||
// return success;
|
||||
|
||||
uint16_t qVecSize = value.size() * sizeof(glm::vec3);
|
||||
|
||||
QByteArray myArray;
|
||||
|
||||
const char* data = (const char*)value.data();
|
||||
|
||||
|
||||
char* sizePointer = (char*)&qVecSize;
|
||||
QByteArray vecSize(sizePointer, sizeof(uint16_t));
|
||||
myArray.append(vecSize);
|
||||
uint16_t arrayLength;
|
||||
memcpy(&arrayLength, myArray.data(), sizeof(uint16_t));
|
||||
qDebug()<<"array length.. shnur"<<arrayLength;
|
||||
|
||||
|
||||
qDebug()<<"vec data size is**"<<value.size() * sizeof(glm::vec3);
|
||||
qDebug()<<"uint data size is **"<<qVecSize;
|
||||
for(int i = 0; i < qVecSize; i++){
|
||||
myArray.append(data[i]);
|
||||
qDebug()<<"arr size at index"<<i<<" "<<myArray.size();
|
||||
}
|
||||
|
||||
for(int i = 0 ; i < myArray.size(); i++){
|
||||
|
||||
}
|
||||
|
||||
qDebug()<<"final array size!"<<myArray.size();
|
||||
qDebug()<<"qVevtor size is..."<<qVecSize;
|
||||
int length = qVecSize + sizeof(uint16_t);
|
||||
bool success = append((const unsigned char*)myArray.constData(), myArray.size());
|
||||
if(success){
|
||||
_bytesOfValues += length;
|
||||
_totalBytesOfValues += length;
|
||||
qDebug()<<"SUCCESS";
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
@ -653,7 +604,6 @@ int OctreePacketData::uppackDataFromBytes(const unsigned char *dataBytes, QVecto
|
|||
uint16_t length;
|
||||
memcpy(&length, dataBytes, sizeof(uint16_t));
|
||||
dataBytes += sizeof(length);
|
||||
qDebug()<<"LENGTH AT UNPACKING:****"<<length;
|
||||
glm::vec3 myVec;
|
||||
for(int i = 0 ; i < length; i+= sizeof(float) * 3) {
|
||||
//Go through and create three floats
|
||||
|
@ -672,7 +622,5 @@ int OctreePacketData::uppackDataFromBytes(const unsigned char *dataBytes, QVecto
|
|||
dataBytes += sizeof(float);
|
||||
result.append(point);
|
||||
}
|
||||
qDebug()<<"LENGTH OF ARRAY ON UNPACKING**"<<length;
|
||||
qDebug()<<"qVector AFTER UNPACKING**"<<result;
|
||||
return length + sizeof(length);
|
||||
}
|
||||
|
|
|
@ -230,10 +230,7 @@ public:
|
|||
static quint64 getTotalBytesOfBitMasks() { return _totalBytesOfBitMasks; } /// total bytes of bitmasks
|
||||
static quint64 getTotalBytesOfColor() { return _totalBytesOfColor; } /// total bytes of color
|
||||
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, float& result) {
|
||||
memcpy(&result, dataBytes, sizeof(result)); return sizeof(result);
|
||||
qDebug()<<"Line Width Value!** after unpacking"<<result;
|
||||
}
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, float& result) {memcpy(&result, dataBytes, sizeof(result)); return sizeof(result);}
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, glm::vec3& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, bool& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
|
||||
static int uppackDataFromBytes(const unsigned char* dataBytes, quint64& result) { memcpy(&result, dataBytes, sizeof(result)); return sizeof(result); }
|
||||
|
|
Loading…
Reference in a new issue