Beispiel #1
0
void ya2d_drawRotateTexture(ya2d_Texture *texp, int x, int y, float angle)
{
        if(!texp->data) return;

		sceGuEnable(GU_TEXTURE_2D);

		sceGuTexMode(texp->texPSM, 0, 0, texp->isSwizzled);
		sceGuTexFunc(GU_TFX_REPLACE, texp->hasAlpha ? GU_TCC_RGBA : GU_TCC_RGB);
		
        ya2d_setTexture(texp);
			
		sceGumPushMatrix(); 
		sceGumLoadIdentity();
		{
			ScePspFVector3 pos = {x + (float)texp->centerX, y + (float)texp->centerY, 0.0f};
			sceGumTranslate(&pos);
			sceGumRotateZ(angle);
		}

		ya2d_FloatTextureVertex *vertices = (ya2d_FloatTextureVertex *)sceGuGetMemory(4 * sizeof(ya2d_FloatTextureVertex));
		
		vertices[0] = (ya2d_FloatTextureVertex){0.0f, 0.0f, (float)-texp->centerX, (float)-texp->centerY, 0.0f};
        vertices[1] = (ya2d_FloatTextureVertex){0.0f, 1.0f, (float)-texp->centerX, (float)texp->centerY, 0.0f};
        vertices[2] = (ya2d_FloatTextureVertex){1.0f, 0.0f, (float)texp->centerX, (float)-texp->centerY, 0.0f};
        vertices[3] = (ya2d_FloatTextureVertex){1.0f, 1.0f, (float)texp->centerX, (float)texp->centerY, 0.0f};
        
		sceGumDrawArray(GU_TRIANGLE_STRIP, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D, 4, 0, vertices);
        
        sceKernelDcacheWritebackRange(vertices, 4 * sizeof(ya2d_FloatTextureVertex));
        sceGumPopMatrix(); 
}
Beispiel #2
0
void Drop::Render(Vector3 playerPos, float camAngle)
{
    if(abs(position.x-playerPos.x) < 8.0f && abs(position.y-playerPos.y) < 5.0f && abs(position.z-playerPos.z) < 8.0f)
    {
        active = true;
    }
    else
    {
        active = false;
    }

    if(toDestroy == false && getMe == false && active == true)
    {
        if(abs(position.x-playerPos.x) < 0.8f && abs(position.y-playerPos.y) < 1.8f && abs(position.z-playerPos.z) < 0.8f && existingTime >= 0.5f && myCrft->InventoryIsFull(id,amount,stackable) == false && myCrft->HP > 0.0f)
        {
            getMe = true;
            return;
        }

        float angle = atan2f(position.x-(playerPos.x+(cosf(camAngle+PI)*4)),position.z-(playerPos.z+(sinf(camAngle+PI)*4)))-PI*0.5f;

        sceGuColor(GU_COLOR(myCrft->BlockFinalLight(position.x,position.y,position.z),myCrft->BlockFinalLight(position.x,position.y,position.z),myCrft->BlockFinalLight(position.x,position.y,position.z),1.0f));
        sceGuEnable(GU_DEPTH_TEST);
        sceGuEnable(GU_ALPHA_TEST);
        sceGuEnable(GU_BLEND);



        if(id < 250)
        {
            sceGumPushMatrix();

            ScePspFVector3 loc = {position.x,position.y+sinf(levit)*0.09f,position.z};
            sceGumTranslate(&loc);

            ScePspFVector3 sca = {0.25f,0.25f,0.25f};
            sceGumScale(&sca);

            sceGumRotateX(0.0f);
            sceGumRotateY(angleBlock);
            sceGumRotateZ(0.0f);

            myCrft->drawCubes(id,myCrft->BlockFinalLight(position.x,position.y,position.z));

            sceGumPopMatrix();

            if(amount >= 3 && stackable == true)
            {
                sceGumPushMatrix();

                ScePspFVector3 loc = {position.x+0.09f,position.y+sinf(levit)*0.09f+0.09f,position.z};
                sceGumTranslate(&loc);

                ScePspFVector3 sca = {0.25f,0.25f,0.25f};
                sceGumScale(&sca);

                sceGumRotateX(0.0f);
                sceGumRotateY(angleBlock);
                sceGumRotateZ(0.0f);

                myCrft->drawCubes(id,myCrft->BlockFinalLight(position.x,position.y,position.z));

                sceGumPopMatrix();
            }
        }
        else
        {
            sceGumPushMatrix();

            ScePspFVector3 loc = {position.x,position.y+sinf(levit)*0.09f,position.z};
            sceGumTranslate(&loc);

            sceGumRotateX(0.0f);
            sceGumRotateY(angle);
            sceGumRotateZ(0.0f);

            myCrft->drawDropItems(id);

            sceGumPopMatrix();
        }

        sceGuDisable(GU_BLEND);
        sceGuDisable(GU_ALPHA_TEST);
        sceGuDisable(GU_DEPTH_TEST);
    }
}