Пример #1
0
//*********************************************************************************************************
void CInstanceMapDeco::onAdd(CGroupMap &owner)
{
	//H_AUTO(R2_CInstanceMapDeco_onAdd)
	nlassert(_Instance);
	nlassert(!_Main);
	nlassert(!_Over);
	nlassert(!_OverInvalid);
	_Main = new CCtrlButtonEntity(*_Instance);
	_Main->setPosRef(Hotspot_MM);
	_Main->setParentPosRef(Hotspot_BL);
	_Main->setModulateGlobalColorAll(false);
	owner.addCtrl(_Main);
	_Main->setParent(&owner);
	_Main->setRenderLayer(2);
	_Main->setId(owner.getId() + ":" + _Instance->getId());
	_Main->setActive(_Active);
	//
	_Over   = newQuad(owner);
	_Over->setRenderLayer(3);
	_Over->setActive(_Active);
	//
	_OverInvalid = newQuad(owner);
	_OverInvalid->setRenderLayer(4);
	_OverInvalid->setActive(_Active && _InvalidPos);
	//
	if (_Orientable)
	{
		_Orient = newQuad(owner);
		_Orient->setTexture(CV_MapEntityOrientTexture.get());
		_Orient->setRenderLayer(3);
		_Orient->setActive(_Active);
	}
	//
	CInterfaceGroup *window = owner.getParentContainer();
	if (window)
	{
		for(uint k = 0; k < 2; ++k)
		{
			_GlowStar[k] = new CCtrlQuad;
			_GlowStar[k]->setActive(false);
			_GlowStar[k]->setModulateGlobalColor(false);
			window->addCtrl(_GlowStar[k]);
			_GlowStar[k]->setParent(window);
			_GlowStar[k]->setAdditif(true);
			_GlowStar[k]->setTexture(CV_MapGlowStarTexture.get());
		}
	}
	_AddedToMap = true;
}
quad comp(quad a, quad b){
    return newQuad(
        newPair((a.first .first * b.first.first  + a.first .second * b.second.first ) % MOD,
                (a.first .first * b.first.second + a.first .second * b.second.second) % MOD),
        newPair((a.second.first * b.first.first  + a.second.second * b.second.first ) % MOD,
                (a.second.first * b.first.second + a.second.second * b.second.second) % MOD)
    );
}
Пример #3
0
//----------
void Canvas::addNew() {
	if (this->connection) {
		shared_ptr<Quad> newQuad(new Quad(this->getNextFreeIndex(), this->projectorSelection->getSelectionIndex(), this->typeSelection->getSelectionDatabaseIndex()));
		
		this->setQuadToScreen(newQuad);
		
		newQuad->update();
		
		this->quads.insert(pair<int, shared_ptr<Quad> >(newQuad->index, newQuad));
		this->setSelection(newQuad);
		
		auto & database = this->connection->getConnection();
		database.insert("quads", newQuad->getDatabaseRow());
	}
}
Пример #4
0
void strassenQuad(Quad *A, Quad *B, Quad *C, size_t size) {
    // if (size == FIXEDSIZE) {
    //   matrixMultiplicationTiled(A, B, C, size);
    //   return;
    // }
    // if (size == FIXEDSIZE) {
    //   matrixMultiplicationFixed(A, B, C);
    //   return;
    // }
    if (size == FIXEDSIZE) {
#if DATATYPE == 0
#if FIXEDSIZE == 32
        asmMul32(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 64
        // printf("64\n");
        asmMul(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 128
        // printf("128\n");
        asmMul128(A->matrix, B->matrix, C->matrix);
#endif

#elif DATATYPE == 1
#if FIXEDSIZE == 64
        asmMulF64(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 128
        asmMulF128(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 256
        asmMulF256(A->matrix, B->matrix, C->matrix);
#endif
#endif //datatype == 0
        return;
    }
    // if (size == FIXEDSIZE) {
    //   return;
    // }
    size_t mid = size / 2;
    Quad *A11 = A->children[0];
    Quad *A12 = A->children[1];
    Quad *A21 = A->children[2];
    Quad *A22 = A->children[3];
    Quad *B11 = B->children[0];
    Quad *B12 = B->children[1];
    Quad *B21 = B->children[2];
    Quad *B22 = B->children[3];

    Quad *T3 = C->children[0];
    subNew(B22->matrix, B12->matrix, T3->matrix, mid);

    Quad *S3 = C->children[1];
    subNew(A11->matrix, A21->matrix, S3->matrix, mid);

    Quad *P7 = C->children[3];
    strassenQuad(S3, T3, P7, mid);

    Quad *T1 = newQuad(mid);
    subNew(B12->matrix, B11->matrix, T1->matrix, mid);

    Quad *S1 = newQuad(mid);
    addNew(A21->matrix, A22->matrix, S1->matrix, mid);

    Quad *P5 = C->children[0];
    strassenQuad(S1, T1, P5, mid);

    subLeft(S1->matrix, A11->matrix, mid);
    Quad *S2 = S1;

    subRight(B22->matrix, T1->matrix, mid);
    Quad *T2 = T1;

    Quad *T4 = C->children[1];
    subNew(T2->matrix, B21->matrix, T4->matrix, mid);

    Quad *P4 = C->children[2];
    strassenQuad(A22, T4, P4, mid);

    strassenQuad(S2, T2, T4, mid);
    Quad *P6 = T4;

    subRight(A12->matrix, S2->matrix, mid);
    Quad *S4 = S2;

    strassenQuad(S4, B22, T2, mid);
    Quad *P3 = T2;

    strassenQuad(A11, B11, S4, mid);
    Quad *P1 = S4;

    addLeft(P6->matrix, P1->matrix, mid);
    Quad *U2 = P6;

    addLeft(P7->matrix, U2->matrix, mid);
    Quad *U3 = P7;

    addLeft(U2->matrix, P5->matrix, mid);
    Quad *U4 = U2;

    subRight(U3->matrix, P4->matrix, mid);
    Quad *U6 = P4;

    addLeft(U3->matrix, P5->matrix, mid);
    Quad *U7 = U3;

    strassenQuad(A12, B21, P5, mid);
    Quad *P2 = P5;

    addLeft(P2->matrix, P1->matrix, mid);
    Quad *U1 = P2;

    addLeft(U4->matrix, P3->matrix, mid);
    Quad *U5 = U4;

    freeQuad(P3);
    freeQuad(P1);

    return;
}
quad get_tr(node *t){
    if(t == NULL)
        return newQuad(newPair(1,0),
                       newPair(0,1));
    return t->tr;
}