potree / CPotree

Potree Utilities
Other
36 stars 25 forks source link

List point data #9

Open ZPyrolink opened 3 years ago

ZPyrolink commented 3 years ago

Hello,

I'm trying to get the list of all the points with their position, color and intensity of a potree project (already converted). To do that, I have added a getColor and getIntensity on the Points class in order to read the rgb and intensity attribute buffer. The problem is that the values returned aren't colors and intensity. Do you have any solution ?

Here is my code :

dvec3 getColor(int64_t i)
{
    shared_ptr<Buffer>& buffer = attributeBuffersMap["rgb"];

    int32_t R, G, B;
    memcpy(&R, buffer -> data_u8 + i * 6 + 0, 2);
    memcpy(&G, buffer -> data_u8 + i * 6 + 2, 2);
    memcpy(&B, buffer -> data_u8 + i * 6 + 4, 2);

    return {R, G, B};
}

int64_t getIntensity(int64_t i)
{
    shared_ptr<Buffer>& buffer = attributeBuffersMap["intensity"];

    int64_t I;
    memcpy(&I, buffer -> data_u8 + i * 2, 2);

    return I;
}

Thank you in advance