void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int verticesDataSize, const void* indicesData, unsigned int numIndices, bool indicesShortType)
    {
        const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);

        const unsigned char* verticesData = (const unsigned char*)vdata;

        const VertexDeclarationGL::Element* el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglEnableVertexAttribArray(el->index);
            oxglVertexAttribPointer(el->index, el->size, el->elemType, el->normalized, decl->size, verticesData + el->offset);
            el++;
        }

        glDrawElements(getPT(pt), numIndices, indicesShortType ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE, indicesData);

        el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglDisableVertexAttribArray(el->index);
            el++;
        }


#if OXYGINE_TRACE_VIDEO_STATS
        _debugAddPrimitives(pt, numIndices);
#endif
        CHECKGL();
    }
    void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int size)
    {
        const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);

        const unsigned char* verticesData = (const unsigned char*)vdata;

        const VertexDeclarationGL::Element* el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglEnableVertexAttribArray(el->index);
            oxglVertexAttribPointer(el->index, el->size, el->elemType, el->normalized, decl->size, verticesData + el->offset);
            el++;
        }

        size_t primitives = size / decl->size;
        glDrawArrays(getPT(pt), 0, (GLsizei)primitives);

        el = decl->elements;
        for (int i = 0; i < decl->numElements; ++i)
        {
            oxglDisableVertexAttribArray(el->index);
            el++;
        }


#if OXYGINE_TRACE_VIDEO_STATS
        _debugAddPrimitives(pt, (int)(GLsizei)primitives);
#endif

        CHECKGL();
    }
Пример #3
0
void Server_Card::getInfo(ServerInfo_Card *info)
{
    QString displayedName = facedown ? QString() : name;
    
    info->set_id(id);
    info->set_name(displayedName.toStdString());
    info->set_x(coord_x);
    info->set_y(coord_y);
    QString ptStr = getPT();
    if (facedown)
    {
        info->set_face_down(true);
        ptStr = getPT();
    }
    info->set_tapped(tapped);
    if (attacking)
        info->set_attacking(true);
    if (!color.isEmpty())
        info->set_color(color.toStdString());
    if (!ptStr.isEmpty())
        info->set_pt(ptStr.toStdString());
    if (!annotation.isEmpty())
        info->set_annotation(annotation.toStdString());
    if (destroyOnZoneChange)
        info->set_destroy_on_zone_change(true);
    if (doesntUntap)
        info->set_doesnt_untap(true);
    
    QMapIterator<int, int> cardCounterIterator(counters);
    while (cardCounterIterator.hasNext()) {
        cardCounterIterator.next();
        ServerInfo_CardCounter *counterInfo = info->add_counter_list();
        counterInfo->set_id(cardCounterIterator.key());
        counterInfo->set_value(cardCounterIterator.value());
    }

    if (parentCard) {
        info->set_attach_player_id(parentCard->getZone()->getPlayer()->getPlayerId());
        info->set_attach_zone(parentCard->getZone()->getName().toStdString());
        info->set_attach_card_id(parentCard->getId());
    }
}
Пример #4
0
QString Server_Card::setAttribute(CardAttribute attribute, const QString &avalue, bool allCards)
{
    switch (attribute) {
        case AttrTapped: {
            bool value = avalue == "1";
            if (!(!value && allCards && doesntUntap))
                setTapped(value);
            break;
        }
        case AttrAttacking: setAttacking(avalue == "1"); break;
        case AttrFaceDown: setFaceDown(avalue == "1"); break;
        case AttrColor: setColor(avalue); break;
        case AttrPT: setPT(avalue); return getPT();
        case AttrAnnotation: setAnnotation(avalue); break;
        case AttrDoesntUntap: setDoesntUntap(avalue == "1"); break;
    }
    return avalue;
}
Пример #5
0
    void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration *decl_, const void *vdata, unsigned int verticesDataSize, const void *indicesData, unsigned int numIndices, bool indicesShortType)
	{
		glBindBuffer(GL_ARRAY_BUFFER, _vbo);
		glBufferData(GL_ARRAY_BUFFER, verticesDataSize * decl_->size, vdata, GL_DYNAMIC_DRAW);

		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ibo);
		glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices * (indicesShortType ? 2 : 1), indicesData, GL_DYNAMIC_DRAW);

		const VertexDeclarationGL *decl = static_cast<const VertexDeclarationGL*>(decl_);

		const unsigned char *verticesData = (const unsigned char *)vdata;


		const VertexDeclarationGL::Element *el = decl->elements;
		for (int i = 0; i < decl->numElements; ++i)		
		{	
			glEnableVertexAttribArray(el->index);
			glVertexAttribPointer(el->index, el->size, el->elemType, el->normalized, decl->size, (void*)(el->offset));
			el++;
		}

		
		glDrawElements(getPT(pt), numIndices, indicesShortType ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE, 0);

		el = decl->elements;
		for (int i = 0; i < decl->numElements; ++i)		
		{			
			glDisableVertexAttribArray(el->index);
			el++;
		}

		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);


#if OXYGINE_TRACE_VIDEO_STATS
		_debugAddPrimitives(pt, numIndices);
#endif
        CHECKGL();
	}
Пример #6
0
float Adafruit_MPL115A2::getTemperature() {
  float     pressureComp, centigrade;

  getPT(&pressureComp, &centigrade);
  return centigrade;
}