Ejemplo n.º 1
0
std::vector<POVMSInt> POVMS_Object::GetIntVector(POVMSType key)
{
    POVMS_Attribute attr;

    Get(key, attr);

    return attr.GetIntVector();
}
Ejemplo n.º 2
0
        case kPOVMsgIdent_FilledRectangleSet:
            DrawFilledRectangleSet(sd, vd, msg, final);
            break;
    }
}

void ImageMessageHandler::DrawPixelSet(const SceneData& sd, const ViewData& vd, POVMS_Object& msg, bool final)
{
    POVMS_Attribute pixelposattr;
    POVMS_Attribute pixelcolattr;
    unsigned int psize(msg.GetInt(kPOVAttrib_PixelSize));

    msg.Get(kPOVAttrib_PixelPositions, pixelposattr);
    msg.Get(kPOVAttrib_PixelColors, pixelcolattr);

    vector<POVMSInt> pixelpositions(pixelposattr.GetIntVector());
    vector<POVMSFloat> pixelcolors(pixelcolattr.GetFloatVector());

    if((pixelpositions.size() / 2) != (pixelcolors.size() / 5))
        throw POV_EXCEPTION(kInvalidDataSizeErr, "Number of pixel colors and pixel positions does not match!");

    for(int i = 0, ii = 0; (i < pixelcolors.size()) && (ii < pixelpositions.size()); i += 5, ii += 2)
    {
        RGBTColour col(pixelcolors[i], pixelcolors[i + 1], pixelcolors[i + 2], pixelcolors[i + 4]); // NB pixelcolors[i + 3] is an unused channel
        RGBTColour gcol(col);
        unsigned int x(pixelpositions[ii]);
        unsigned int y(pixelpositions[ii + 1]);
        Display::RGBA8 rgba;
        float dither = GetDitherOffset(x, y);

        if (vd.display != nullptr)