Ejemplo n.º 1
0
TextRenderingPainter::TextRenderingPainter(gloperate::ResourceManager & resourceManager, const cpplocate::ModuleInfo & moduleInfo)
: PipelinePainter("TextRendering", resourceManager, moduleInfo, m_pipeline)
{
    // Setup painter
    auto targetFBO = addCapability(new gloperate::TargetFramebufferCapability());
    auto viewport = addCapability(new gloperate::ViewportCapability());
    auto time = addCapability(new gloperate::VirtualTimeCapability());

    m_pipeline.targetFBO.setData(targetFBO);
    m_pipeline.viewport.setData(viewport);
    m_pipeline.time.setData(time);
    m_pipeline.resourceManager.setData(&resourceManager);

    targetFBO->changed.connect([this]() { m_pipeline.targetFBO.invalidate(); });
    viewport->changed.connect([this]() { m_pipeline.viewport.invalidate(); });
    time->changed.connect([this]() { m_pipeline.time.invalidate(); });

    time->setLoopDuration(glm::pi<float>() * 2);

    reflectionzeug::PropertyGroup * fontLoading = addGroup("Font");
    fontLoading->addProperty(createProperty("Filename", m_pipeline.fontFilename));

    reflectionzeug::PropertyGroup * textGeneration = addGroup("Text");
    textGeneration->addProperty(createProperty("Algorithm", m_pipeline.textGenerationAlgorithm));
    textGeneration->addProperty(createProperty("StaticText", m_pipeline.staticText));
    textGeneration->addProperty(createProperty("Length", m_pipeline.length));
    //textGeneration->addProperty(createProperty("Encoding", m_pipeline.encoding));
    textGeneration->addProperty(createProperty("XRepeat", m_pipeline.xRepeat));
    textGeneration->addProperty(createProperty("YRepeat", m_pipeline.yRepeat));
    textGeneration->addProperty(createProperty("JiggleRadius", m_pipeline.jiggleRadius));

    reflectionzeug::PropertyGroup * rendering = addGroup("Rendering");
    rendering->addProperty(createProperty("FontColor", m_pipeline.fontColor));
    rendering->addProperty(createProperty("DistanceThreshold", m_pipeline.distanceThreshold));
}
OpenGLExample::OpenGLExample(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo)
:   Painter("EmptyExample", resourceManager, pluginInfo)
,   m_targetFramebufferCapability(addCapability(new gloperate::TargetFramebufferCapability()))
,   m_viewportCapability(addCapability(new gloperate::ViewportCapability()))
,   m_projectionCapability(addCapability(new gloperate::PerspectiveProjectionCapability(m_viewportCapability)))
,   m_cameraCapability(addCapability(new gloperate::CameraCapability()))
{
}
Ejemplo n.º 3
0
OpenGLExample::OpenGLExample(gloperate::ResourceManager & resourceManager)
:   Painter(resourceManager)
,   m_targetFramebufferCapability(addCapability(new gloperate::TargetFramebufferCapability()))
,   m_viewportCapability(addCapability(new gloperate::ViewportCapability()))
,   m_projectionCapability(addCapability(new gloperate::PerspectiveProjectionCapability(m_viewportCapability)))
,   m_cameraCapability(addCapability(new gloperate::CameraCapability()))
{
}
// Called for each instruction that resides in a block.
void Builder::postProcess(const Instruction& inst)
{
    // Add capabilities based simply on the opcode.
    switch (inst.getOpCode()) {
    case OpExtInst:
        switch (inst.getImmediateOperand(1)) {
        case GLSLstd450InterpolateAtCentroid:
        case GLSLstd450InterpolateAtSample:
        case GLSLstd450InterpolateAtOffset:
            addCapability(CapabilityInterpolationFunction);
            break;
        default:
            break;
        }
        break;
    case OpDPdxFine:
    case OpDPdyFine:
    case OpFwidthFine:
    case OpDPdxCoarse:
    case OpDPdyCoarse:
    case OpFwidthCoarse:
        addCapability(CapabilityDerivativeControl);
        break;

    case OpImageQueryLod:
    case OpImageQuerySize:
    case OpImageQuerySizeLod:
    case OpImageQuerySamples:
    case OpImageQueryLevels:
        addCapability(CapabilityImageQuery);
        break;

#ifdef NV_EXTENSIONS
    case OpGroupNonUniformPartitionNV:
        addExtension(E_SPV_NV_shader_subgroup_partitioned);
        addCapability(CapabilityGroupNonUniformPartitionedNV);
        break;
#endif

    default:
        break;
    }

    // Checks based on type
    if (inst.getTypeId() != NoType)
        postProcessType(inst, inst.getTypeId());
    for (int op = 0; op < inst.getNumOperands(); ++op) {
        if (inst.isIdOperand(op)) {
            // In blocks, these are always result ids, but we are relying on
            // getTypeId() to return NoType for things like OpLabel.
            if (getTypeId(inst.getIdOperand(op)) != NoType)
                postProcessType(inst, getTypeId(inst.getIdOperand(op)));
        }
    }
}
Ejemplo n.º 5
0
/**
*  @brief
*    Constructor
*/
OsgPainter::OsgPainter(ResourceManager & resourceManager, const std::string & name)
: Painter(resourceManager, name)
, m_viewer(nullptr)
, m_embedded(nullptr)
, m_scene(nullptr)
, m_viewportX(0)
, m_viewportY(0)
, m_viewportWidth(0)
, m_viewportHeight(0)
{
    // Register capabilities
    m_viewportCapability = addCapability(new gloperate::ViewportCapability);
    m_targetFramebufferCapability = addCapability(new gloperate::TargetFramebufferCapability);
    m_inputCapability = addCapability(new gloperate::InputCapability);
    m_virtualTimeCapability = addCapability(new gloperate::VirtualTimeCapability);
}
Ejemplo n.º 6
0
int QLCChannel_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: groupList(); break;
        case 1: name(); break;
        case 2: group(); break;
        case 3: controlByte(); break;
        case 4: colourList(); break;
        case 5: colour(); break;
        case 6: searchCapabilityByValue(); break;
        case 7: searchCapabilityByName(); break;
        case 8: addCapability(); break;
        case 9: removeCapability(); break;
        case 10: sortCapabilities(); break;
        case 11: copy(); break;
        case 12: load(); break;
        case 13: loadWrongRoot(); break;
        case 14: save(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Ejemplo n.º 7
0
bool QLCChannel::loadXML(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCChannel)
    {
        qWarning() << "Channel node not found.";
        return false;
    }

    /* Get channel name */
    QString str = root.attribute(KXMLQLCChannelName);
    if (str.isEmpty() == true)
        return false;
    setName(str);

    /* Subtags */
    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == KXMLQLCCapability)
        {
            /* Create a new capability and attempt to load it */
            QLCCapability* cap = new QLCCapability();
            if (cap->loadXML(tag) == true)
            {
                /* Loading succeeded */
                if (addCapability(cap) == false)
                {
                    /* Value overlaps with existing value */
                    delete cap;
                }
            }
            else
            {
                /* Loading failed */
                delete cap;
            }
        }
        else if (tag.tagName() == KXMLQLCChannelGroup)
        {
            str = tag.attribute(KXMLQLCChannelGroupByte);
            setControlByte(ControlByte(str.toInt()));
            setGroup(stringToGroup(tag.text()));
        }
        else if (tag.tagName() == KXMLQLCChannelColour)
        {
            setColour(stringToColour(tag.text()));
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Channel tag: " << tag.tagName();
        }

        node = node.nextSibling();
    }

    return true;
}
Postprocessing::Postprocessing(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo)
: PipelinePainter("Postprocessing", resourceManager, pluginInfo, m_pipeline)
, m_animation(true)
{
    // Setup painter
    auto targetFBO = addCapability(new gloperate::TargetFramebufferCapability());
    auto viewport = addCapability(new gloperate::ViewportCapability());
    auto time = addCapability(new gloperate::VirtualTimeCapability());
    auto camera = addCapability(new gloperate::CameraCapability());
    auto projection = addCapability(new gloperate::PerspectiveProjectionCapability(viewport));
    auto renderTargets = addCapability(new gloperate::TypedRenderTargetCapability());

    m_pipeline.targetFBO.setData(targetFBO);
    m_pipeline.viewport.setData(viewport);
    m_pipeline.time.setData(time);
    m_pipeline.camera.setData(camera);
    m_pipeline.projection.setData(projection);
    m_pipeline.renderTargets.setData(renderTargets);

    targetFBO->changed.connect([this]() { m_pipeline.targetFBO.invalidate(); });
    viewport->changed.connect([this]() { m_pipeline.viewport.invalidate(); });
    time->changed.connect([this]() { m_pipeline.time.invalidate(); });
    
    projection->setZNear(0.1f);
    projection->setZFar(16.f);
    
    time->setLoopDuration(glm::pi<float>() * 2);

    // Register properties
    addProperty<bool>("Animation", this, &Postprocessing::animation, &Postprocessing::setAnimation);
}
Ejemplo n.º 9
0
bool QLCChannel::loadXML(const QDomElement* root)
{
	QDomNode node;
	QDomElement tag;
	QString str;

	Q_ASSERT(root != NULL);

	/* Get channel name */
	str = root->attribute(KXMLQLCChannelName);
	if (str == QString::null)
		return false;
	else
		setName(str);

	/* Subtags */
	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();

		if (tag.tagName() == KXMLQLCCapability)
		{
			addCapability(new QLCCapability(&tag));
		}
		else if (tag.tagName() == KXMLQLCChannelGroup)
		{
			str = tag.attribute(KXMLQLCChannelGroupByte);
			setControlByte(str.toInt());
			setGroup(tag.text());
		}
		else
		{
			qDebug() << "Unknown Channel tag: " << tag.tagName();
		}

		node = node.nextSibling();
	}

	return true;
}
Ejemplo n.º 10
0
bool QLCChannel::loadXML(const QDomElement* root)
{
    QDomNode node;
    QDomElement tag;
    QString str;

    Q_ASSERT(root != NULL);

    if (root->tagName() != KXMLQLCChannel)
    {
        qWarning() << "Channel node not found.";
        return false;
    }

    /* Get channel name */
    str = root->attribute(KXMLQLCChannelName);
    if (str == QString::null)
        return false;
    else
        setName(str);

    /* Subtags */
    node = root->firstChild();
    while (node.isNull() == false)
    {
        tag = node.toElement();

        if (tag.tagName() == KXMLQLCCapability)
        {
            /* Create a new capability and attempt to load it */
            QLCCapability* cap = new QLCCapability();
            if (cap->loadXML(&tag) == true)
            {
                /* Loading succeeded */
                if (addCapability(cap) == false)
                {
                    /* Value overlaps with existing value */
                    delete cap;
                }
            }
            else
            {
                /* Loading failed */
                delete cap;
            }
        }
        else if (tag.tagName() == KXMLQLCChannelGroup)
        {
            str = tag.attribute(KXMLQLCChannelGroupByte);
            setControlByte(str.toInt());
            setGroup(tag.text());
        }
        else
        {
            qDebug() << "Unknown Channel tag: " << tag.tagName();
        }

        node = node.nextSibling();
    }

    return true;
}
Ejemplo n.º 11
0
void ICQClient::sendCapability(const QString &away_msg)
{
    Buffer cap;
    capability c;

    memcpy(c, capabilities[CAP_SIM], sizeof(c));
    const char *ver = VERSION;
    unsigned char *pack_ver = c + sizeof(capability) - 4;
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    unsigned char os_ver;
#ifdef WIN32
    os_ver = 0x80;
#else
#ifdef QT_MACOSX_VERSION
    os_ver = 0x40;
#else
    os_ver = 0;
#endif
#endif
    *(pack_ver++) = os_ver;
    addCapability(cap, CAP_AIM_SHORTCAPS);
    addCapability(cap, CAP_AIM_SUPPORT);
//    addCapability(cap, CAP_AVATAR);
    if (m_bAIM){
        addCapability(cap, CAP_AIM_CHAT);
        addCapability(cap, CAP_AIM_BUDDYCON);
        addCapability(cap, CAP_AIM_IMIMAGE);
        addCapability(cap, CAP_AIM_SENDFILE);
        addCapability(cap, CAP_AIM_BUDDYLIST);
    }else{
        addCapability(cap, CAP_DIRECT);
        addCapability(cap, CAP_SRV_RELAY);
        addCapability(cap, CAP_XTRAZ);
        if (getSendFormat() <= 1)
            addCapability(cap, CAP_UTF);
        if (getSendFormat() == 0)
            addCapability(cap, CAP_RTF);
    }
    if (!getDisableTypingNotification())
        cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability));

    cap.pack((char*)c, sizeof(c));
    snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO);
    if (m_bAIM){
        if (data.owner.ProfileFetch.bValue){
            QString profile;
            profile = QString("<HTML>") + data.owner.About.ptr + "</HTML>";
            encodeString(profile, "text/aolrtf", 1, 2);
        }
        if (!away_msg.isNull())
            encodeString(away_msg, "text/plain", 3, 4);
    }
    m_socket->writeBuffer.tlv(0x0005, cap);
    if (m_bAIM)
        m_socket->writeBuffer.tlv(0x0006, "\x00\x04\x00\x02\x00\x02", 6);
    sendPacket(true);
}
// Hook to visit each operand type and result type of an instruction.
// Will be called multiple times for one instruction, once for each typed
// operand and the result.
void Builder::postProcessType(const Instruction& inst, Id typeId)
{
    // Characterize the type being questioned
    Id basicTypeOp = getMostBasicTypeClass(typeId);
    int width = 0;
    if (basicTypeOp == OpTypeFloat || basicTypeOp == OpTypeInt)
        width = getScalarTypeWidth(typeId);

    // Do opcode-specific checks
    switch (inst.getOpCode()) {
    case OpLoad:
    case OpStore:
        if (basicTypeOp == OpTypeStruct) {
            if (containsType(typeId, OpTypeInt, 8))
                addCapability(CapabilityInt8);
            if (containsType(typeId, OpTypeInt, 16))
                addCapability(CapabilityInt16);
            if (containsType(typeId, OpTypeFloat, 16))
                addCapability(CapabilityFloat16);
        } else {
            StorageClass storageClass = getStorageClass(inst.getIdOperand(0));
            if (width == 8) {
                switch (storageClass) {
                case StorageClassUniform:
                case StorageClassStorageBuffer:
                case StorageClassPushConstant:
                    break;
                default:
                    addCapability(CapabilityInt8);
                    break;
                }
            } else if (width == 16) {
                switch (storageClass) {
                case StorageClassUniform:
                case StorageClassStorageBuffer:
                case StorageClassPushConstant:
                case StorageClassInput:
                case StorageClassOutput:
                    break;
                default:
                    if (basicTypeOp == OpTypeInt)
                        addCapability(CapabilityInt16);
                    if (basicTypeOp == OpTypeFloat)
                        addCapability(CapabilityFloat16);
                    break;
                }
            }
        }
        break;
    case OpAccessChain:
    case OpPtrAccessChain:
    case OpCopyObject:
    case OpFConvert:
    case OpSConvert:
    case OpUConvert:
        break;
    default:
        if (basicTypeOp == OpTypeFloat && width == 16)
            addCapability(CapabilityFloat16);
        if (basicTypeOp == OpTypeInt && width == 16)
            addCapability(CapabilityInt16);
        if (basicTypeOp == OpTypeInt && width == 8)
            addCapability(CapabilityInt8);
        break;
    }
}