Exemple #1
0
static int		julia_pt(t_env *env, t_long x, t_long y)
{
	t_ni			c;
	t_ni			z;
	t_ni			sq;
	int				i;

	c = NI((env->offset.x - (env->mousepos.x - WIDTH)) / env->zoom,
		(env->offset.y - (env->mousepos.y - HEIGHT)) / env->zoom);
	z = NI(x / env->zoom, y / env->zoom);
	sq = NI(z.r * z.r, z.i * z.i);
	i = env->max_loop + env->offset_loop;
	while ((sq.r + sq.i) < MAX_I && --i > 0)
	{
		sq.r = z.r * z.r;
		sq.i = z.i * z.i;
		z.i = 2 * z.i * z.r + c.i;
		z.r = sq.r - sq.i + c.r;
	}
	return (env->max_loop + env->offset_loop - i);
}
bool CorporationDB::UpdateLogo(uint32 corpID, const Call_UpdateLogo & upd, PyDict * notif) {
    DBQueryResult res;

    if (!sDatabase.RunQuery(res,
        " SELECT shape1, shape2, shape3, color1, color2, color3, typeface "
        " FROM corporation "
        " WHERE corporationID = %u ", corpID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    DBResultRow row;
    if (!res.GetRow(row)) {
        _log(DATABASE__ERROR, "Corporation %u doesn't exists.", corpID);
        return false;
    }

    std::vector<std::string> dbQ;
    ProcessIntChange("shape1", NI(0), upd.shape1, notif, dbQ);
    ProcessIntChange("shape2", NI(1), upd.shape2, notif, dbQ);
    ProcessIntChange("shape3", NI(2), upd.shape3, notif, dbQ);

    ProcessIntChange("color1", NI(3), upd.color1, notif, dbQ);
    ProcessIntChange("color2", NI(4), upd.color2, notif, dbQ);
    ProcessIntChange("color3", NI(5), upd.color3, notif, dbQ);

    std::string query = " UPDATE corporation SET ";

    int N = dbQ.size();
    for (int i = 0; i < N; i++) {
        query += dbQ[i];
        if (i < N - 1) query += ", ";
    }

    query += " WHERE corporationID = %u ";
    if ((N > 0) && (!sDatabase.RunQuery(res.error, query.c_str(), corpID))) {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return false;
    }

    return true;
}
Exemple #3
0
void
GetSpritePosition(struct _DeviceIntRec *pDev, int *px, int *py)
{
	NI();
}
     64,         8192,   2048,      64,         2,          3,          1 },
                                              
    {0xD5, 0x14, /* K9GAG08UOM */
     128,        4096,   4096,      128,        2,          3,          2 },
                                              
    {0xD5, 0x55, /* K9LAG08UOM, K9HBG08U1M, K9MCG08U5M */
     128,        8192,   2048,      64,         2,          3,          4 },
                                 
    {0xD7, 0x55, /* K9LBG08UOM */
     128,        8192,   4096,      128,        2,          3,          4 },
};

#define NI(id, x) {id, (struct nand_info*)x, (sizeof(x)/sizeof(struct nand_info))}
static const struct nand_manufacturer all[] =
{
    NI(0xEC, samsung),
};

// -----------------------------------------------------------------------------

struct nand_info* nand_identify(unsigned char data[5])
 {
    unsigned int i;
    int found = -1;
    
    for(i = 0; i < (sizeof(all)/sizeof(struct nand_manufacturer)); i++)
    {
        if(data[0] == all[i].id)
        {
            found = i;
            break;
Exemple #5
0
void OnVDP_SetHistogram( void )
{
	int menu, r;
	int rEnable;
	int i;
	int xpos[7], ypos[7], cdf_y[7];
	int x0, y0, x1, y1;
	int cdf_min, cdf_max;
	int manualMode, autoLevel;
	int devLimit, temporalSmoothing;
	int key;

	//
	while(1){
		//
		r = Input_SelectOneOf2( (SelectMenuInfo_t*)&SMI_Histogram, DefaultMode_eUseOriginal, &menu );
		if( r==eVDPR_NoSelection ){ return; }

		//
		switch( menu ){
			case 0 :
				VDP_SetHistogram( eFlag_Toggle, &rEnable );
				rprint1n( "Histogram %s", (rEnable?"Enabled":"Disabled") );
				break;

#if 0	// TODO?
			case 1 :
				VDP_GetHistogram2( &rEnable, &manualMode, &autoLevel );
				rprint1n( "Histogram %s, ManualMode=%X, AutoLevel=%d", (rEnable?"Enabled":"Disabled"), manualMode, autoLevel );

				manualMode = Input_GetValue( "\nManualMode (* Current) = 0x", Digit_eHex, Input_eHasDefault, manualMode );
				autoLevel = Input_GetValue( "\nAutoLevel (* Current) = ", Digit_eDec, Input_eHasDefault, autoLevel );

				VDP_SetHistogram2( rEnable, manualMode, autoLevel );
				break;

			case 2 :
				//
				VDP_GetHistogram_ManualXPos( xpos );
				rprint1n( "X Pos = " );
				for( i=0; i<7; i++ ){
					rprint1n( "%3d ", xpos[i] );
				}

				//
				for( i=0; i<7; i++ ){
					rprint1n( "Xpos [%d] = ", i );

					xpos[i] = GetIntDec32Prompt("");
				}

				//
				VDP_SetHistogram_ManualXPos( xpos );
				break;

			case 3 :
				//
				VDP_GetHistogram_ManualYPos( ypos );
				rprint1n( "Y Pos = " );
				for( i=0; i<7; i++ ){
					rprint1n( "%3d ", ypos[i] );
				}

				//
				for( i=0; i<7; i++ ){
					rprint1n( "Ypos [%d] = ", i );

					ypos[i] = GetIntDec32Prompt("");
				}

				//
				VDP_SetHistogram_ManualYPos( ypos );
				break;

			case  4 :
				VDP_GetHistogram_AutoParam( &devLimit, &temporalSmoothing );
				rprint1n( "DevLimit =%d, TemporalSmoothing=%d", devLimit, temporalSmoothing );
				devLimit = Input_GetValue( "\nDev. Limit (* Current) = ", Digit_eDec, Input_eHasDefault, devLimit );
				temporalSmoothing = Input_GetValue( "\nTemporalSmoothing (* Current) = ", Digit_eDec, Input_eHasDefault, temporalSmoothing );

				VDP_SetHistogram_AutoParam( devLimit, temporalSmoothing );
				break;

			case 5 :
				VDP_GetHistogram_AutoCalcArea( &x0, &y0, &x1, &y1 );
				rprint1n( "Auto Calc. Area (x0,y0), (x1,y1) = (%d,%d), (%d,%d)", x0, y0, x1, y1 );

				Input_GetValue2( "start (x,y) (*Current) = ", Digit_eDec, Input_eHasDefault, x0, y0, &x0, &y0 );
				Input_GetValue2( "  end (x,y) (*Current) = ", Digit_eDec, Input_eHasDefault, x1, y1, &x1, &y1 );

				VDP_SetHistogram_AutoCalcArea( x0, y0, x1, y1 );
				break;

			case 6 :
				VDP_GetHistogram_ManualXPos( xpos );
				for( i=0; i<7; i++ ){
					rprint1n( "%3d ", xpos[i] );
				}NewLine();

				do{
					VDP_GetHistogram_CDF(	&cdf_min, &cdf_max, cdf_y );

					rprint1n( "CDF Min=%d, Max=%d   CDF = ", cdf_min, cdf_max );
					for( i=0; i<7; i++ ){
						rprint1n( "%3d ", cdf_y[i] );
					}NewLine();

					key = GetKey();
				}while( key==KEY_SPACE || key==KEY_ENTER );
				break;
#endif

			default :
				NI();
				break;
		}
	}
}
int PreprocessOccluders(const tmatrix &invCameraMat)
{
	if (!GetInstancesCount(ZOccluderBox))
		return 0;

	PROFILER_START(PreprocessOccluders);

	tvector3 campos = invCameraMat.V4.position;
	tvector3 camdir = invCameraMat.V4.dir;

	FActiveOccluder* pActiveOccluder = &gActiveOccluders[0]; 
    tvector4 viewPoint = vector4(campos.x, campos.y, campos.z, 0);
    tvector4 viewDir = vector4(camdir.x, camdir.y, camdir.z, 0);
	float sqrFar = 1000.0f * 1000.0f;
	float sqrDist;
	int i;

	gNbActiveOccluders = 0;
	gOccluderBoxes.clear();

	ZOccluderBox *pocc = (ZOccluderBox*)FirstInstanceOf(ZOccluderBox);
	while (pocc)
	{
		addDynamicOccluder(pocc->GetTransform());

		pocc = (ZOccluderBox*)NI(pocc);
	}

    
    for (unsigned int ju = 0;ju<gOccluderBoxes.size(); ju++)
	{
		// todo : frustum culling of the  occluder (except far plane)
		// todo : compute solid angle to reorder occluder accordingly
		FOccluderBox *obox = &gOccluderBoxes[ju];

         //= oboxiter.Get();
		// check for far plane
		const tvector3 &oboxcenter = obox->mCenter;//pocc->GetTransform()->GetWorldMatrix().position;
		sqrDist= SquaredDistance(viewPoint, oboxcenter);
		if (sqrDist > sqrFar)
		{
			continue;
		}

		// check for near plane
		if (DotProduct(tvector3(viewDir), tvector3(oboxcenter - viewPoint)) < 0.0f)
		{
			continue;
		}

		// select planes of the occluder box that lies on the viewing direction
		// todo : reduce to 3 planes instead of 6 (due to box symetry)
		float invSqrDist = 1.0f/sqrDist;//Rcp(sqrDist);

		pActiveOccluder->mSolidAngle = 0.0f;

		BoxSilhouette	silhouette;

		silhouette.vertices = &obox->mVertex[0];

		for (i=0; i<6; i++)
		{
			tvector4 dir= obox->mVertex[FaceVertexIndex[i][0]];
			dir -= viewPoint;
			float vdotp = silhouette.dots[i] = DotProduct(obox->mPlanes[i], dir);

			// compute the maximum solidAngle of the box : -area * v.p/d.d
			pActiveOccluder->mSolidAngle = Max(-obox->mVertex[i].w * vdotp * invSqrDist, pActiveOccluder->mSolidAngle);

		}

		// exit if the occluder is not relevant enough
		if (pActiveOccluder->mSolidAngle < gMinSolidAngle)
			continue;


		int	  nPlanes = 0;
		tvector4*	pPlanes = &pActiveOccluder->mPlanes[0];

		// find silhouette
		tvector4		vertices[12];
        int			nVertices = silhouette.findSilhouette(vertices);

		// create a plane with a edge of the occluder and the viewpoint
        
		for (i=0; i<nVertices; i+=2)
		{
            //tplane plan(campos, vertices[i], vertices[i+1]);
            
			tvector3	v1 = vertices[i];
			v1 -= viewPoint;
			tvector3	v2 = vertices[i+1];
			v2 -= viewPoint;

            v1.Normalize();
            v2.Normalize();
			*pPlanes = CrossProduct(v1, v2);
			pPlanes->Normalize();
			
			pPlanes->w = - DotProduct(*pPlanes, vertices[i]);

			pPlanes++;
			nPlanes ++;

		}
    
		if (gAddNearPlane)
		{
			for (int i=0; i<6; i++)
			{
				if (silhouette.dots[i] < 0.0f)
				{
					pActiveOccluder->mPlanes[nPlanes] = obox->mPlanes[i];
					nPlanes++;
				}
			}
		}
        
		pActiveOccluder->mNbPlanes = nPlanes;

		pActiveOccluder++;
		gNbActiveOccluders++;

		if (gNbActiveOccluders >= gMaxCandidateOccluders)
			break;
		
	}
	

	if (gNbActiveOccluders)
	{
		qsort(gActiveOccluders, gNbActiveOccluders, sizeof(FActiveOccluder), compareOccluder);
		if (gNbActiveOccluders > gMaxActiveOccluders)
			gNbActiveOccluders = gMaxActiveOccluders;
	}

	PROFILER_END();
	return gNbActiveOccluders;
}
Exemple #7
0
bool QEglGLPixmapData::scroll(int dx, int dy, const QRect &rect)
{
    NI();
    return false;
}