Пример #1
0
void DrawBackground2D(u32 rgba)
{
    
    tiny3d_SetPolygon(TINY3D_QUADS);

    tiny3d_VertexPos(0  , 0  , 65535);
    tiny3d_VertexColor(rgba);

    tiny3d_VertexPos(847, 0  , 65535);

    tiny3d_VertexPos(847, 511, 65535);

    tiny3d_VertexPos(0  , 511, 65535);
    tiny3d_End();

    tiny3d_SetPolygon(TINY3D_LINE_LOOP);

    tiny3d_VertexPos(0  , 0  , 65535);
    tiny3d_VertexColor(0xffffffff);

    tiny3d_VertexPos(847, 0  , 65535);

    tiny3d_VertexPos(847, 511, 65535);

    tiny3d_VertexPos(0  , 511, 65535);
    tiny3d_End();
}
Пример #2
0
void DrawAdjustBackground(u32 rgba)
{
   
    tiny3d_SetPolygon(TINY3D_LINE_LOOP);

    tiny3d_VertexPos(0  , 0  , 65535);
    tiny3d_VertexColor(rgba);

    tiny3d_VertexPos(847, 0  , 65535);

    tiny3d_VertexPos(847, 511, 65535);

    tiny3d_VertexPos(0  , 511, 65535);
    tiny3d_End();

    tiny3d_SetPolygon(TINY3D_LINES);

    tiny3d_VertexPos(0        , 0        , 65535);
    tiny3d_VertexColor(rgba);

    tiny3d_VertexPos(120      , 120      , 65535);

    tiny3d_VertexPos(847      , 0        , 65535);
    tiny3d_VertexPos(847 - 120, 120      , 65535);

    tiny3d_VertexPos(847, 511, 65535);
    tiny3d_VertexPos(847 - 120, 511 - 120, 65535);

    tiny3d_VertexPos(0  , 511, 65535);
    tiny3d_VertexPos(120      , 511 - 120, 65535);
    tiny3d_End();


}
Пример #3
0
void draw_twat(float x, float y, float angle)
{
    int n;

    float ang, angs = 6.2831853071796 / 8, angs2 = 6.2831853071796 / 32;

    MATRIX matrix;

    // rotate and translate the sprite
    matrix = MatrixRotationZ(angle);
    matrix = MatrixMultiply(matrix, MatrixTranslation(x , y , 65535.0f));

    // fix ModelView Matrix
    tiny3d_SetMatrixModelView(&matrix);

    tiny3d_SetPolygon(TINY3D_TRIANGLES);

    ang = 0.0f;

    for(n = 0; n <8; n++) {

        tiny3d_VertexPos(4.0f *sinf(ang), 4.0f *cosf(ang), 0);
        tiny3d_VertexColor(0xffffff30);
        tiny3d_VertexPos(7.0f *sinf(ang+angs/2), 7.0f *cosf(ang+angs/2), 0);
        tiny3d_VertexColor(0xff00ff40);
        tiny3d_VertexPos(4.0f *sinf(ang+angs), 4.0f *cosf(ang+angs), 0);
        tiny3d_VertexColor(0xffffff30);

        ang += angs;
    }

    tiny3d_End();

    tiny3d_SetPolygon(TINY3D_POLYGON);

    ang = 0.0f;

    for(n = 0; n <32; n++) {
        tiny3d_VertexPos(3.0f * sinf(ang), 3.0f * cosf(ang), 0);
        if(n & 1) tiny3d_VertexColor(0x80ffff40);
        else tiny3d_VertexColor(0xffffff40);
        ang += angs2;
    }

    tiny3d_End();

    tiny3d_SetMatrixModelView(NULL); // set matrix identity

}
Пример #4
0
void DrawSpritesRot2D(float x, float y, float layer, float dx, float dy, u32 rgba, float angle)
{
    dx /= 2.0f; dy /= 2.0f;

    MATRIX matrix;
    
    // rotate and translate the sprite
    matrix = MatrixRotationZ(angle);
    matrix = MatrixMultiply(matrix, MatrixTranslation(x + dx, y + dy, 0.0f));
    
    // fix ModelView Matrix
    tiny3d_SetMatrixModelView(&matrix);
   
    tiny3d_SetPolygon(TINY3D_QUADS);

    tiny3d_VertexPos(-dx, -dy, layer);
    tiny3d_VertexColor(rgba);
    tiny3d_VertexTexture(0.0f , 0.0f);

    tiny3d_VertexPos(dx , -dy, layer);
    tiny3d_VertexTexture(0.99f, 0.0f);

    tiny3d_VertexPos(dx , dy , layer);
    tiny3d_VertexTexture(0.99f, 0.99f);

    tiny3d_VertexPos(-dx, dy , layer);
    tiny3d_VertexTexture(0.0f , 0.99f);

    tiny3d_End();

    tiny3d_SetMatrixModelView(NULL); // set matrix identity

}
Пример #5
0
void DrawLineBox(float x, float y, float z, float w, float h, u32 rgba)
{
    tiny3d_SetPolygon(TINY3D_LINE_LOOP);
       
    tiny3d_VertexPos(x    , y    , z);
    tiny3d_VertexColor(rgba);

    tiny3d_VertexPos(x + w, y    , z);

    tiny3d_VertexPos(x + w, y + h, z);

    tiny3d_VertexPos(x    , y + h, z);

    tiny3d_End();
}
Пример #6
0
static void tiny3d_WaitRSX()
{
    int i = 0;

    tiny3d_End();

    
	while (CtrlReg->get != CtrlReg->put  && (i < 5000)) {
		usleep(200);CtrlReg = gcmGetControlRegister();
        __asm __volatile__("sync");
		i++;
	}
    
  
}
Пример #7
0
void tiny3d_Flip()
{
    
    tiny3d_End();

    flip(Video_currentBuffer); // Flip buffer onto screen
    tiny3d_WaitRSX();
    Video_currentBuffer = !Video_currentBuffer;
    sysUtilCheckCallback();
    waitFlip();
    

    pos_rsx_vertex = 0;
    current_shader = -1;
    polygon = -1;
    off_head_vertex = off_start_vertex = 0;
    flag_vertex = VERTEX_LOCK;

}
Пример #8
0
void DrawSprites2D(float x, float y, float layer, float dx, float dy, u32 rgba)
{
    tiny3d_SetPolygon(TINY3D_QUADS);

    tiny3d_VertexPos(x     , y     , layer);
    tiny3d_VertexColor(rgba);
    tiny3d_VertexTexture(0.0f, 0.0f);

    tiny3d_VertexPos(x + dx, y     , layer);
    tiny3d_VertexTexture(0.99f, 0.0f);

    tiny3d_VertexPos(x + dx, y + dy, layer);
    tiny3d_VertexTexture(0.99f, 0.99f);

    tiny3d_VertexPos(x     , y + dy, layer);
    tiny3d_VertexTexture(0.0f, 0.99f);

    tiny3d_End();
}
Пример #9
0
void DrawTextBox(float x, float y, float z, float w, float h, u32 rgba)
{
    tiny3d_SetPolygon(TINY3D_QUADS);
    
   
    tiny3d_VertexPos(x    , y    , z);
    tiny3d_VertexColor(rgba);
    tiny3d_VertexTexture(0.0f , 0.0f);

    tiny3d_VertexPos(x + w, y    , z);
    tiny3d_VertexTexture(0.99f, 0.0f);

    tiny3d_VertexPos(x + w, y + h, z);
    tiny3d_VertexTexture(0.99f, 0.99f);

    tiny3d_VertexPos(x    , y + h, z);
    tiny3d_VertexTexture(0.0f , 0.99f);

    tiny3d_End();
}
Пример #10
0
void DrawColorSquare(float x, float y, float z, float dx, float dy, float r, float g, float b, float a)
{
    tiny3d_SetPolygon(TINY3D_QUADS);

    tiny3d_VertexPos(x     , y     , z);
    tiny3d_VertexFcolor(r, g, b, a);
    tiny3d_VertexTexture(0.0f, 0.0f);
    

    tiny3d_VertexPos(x + dx, y     , z);
    tiny3d_VertexTexture(0.99f, 0.0f);
   

    tiny3d_VertexPos(x + dx, y + dy, z);
    tiny3d_VertexTexture(0.99f, 0.99f);
  
    tiny3d_VertexPos(x     , y + dy, z);
    tiny3d_VertexTexture(0.0f, 0.99f);
    

    tiny3d_End();
}
Пример #11
0
void DrawSquare(float x, float y, float z, float dx, float dy)
{
    tiny3d_SetPolygon(TINY3D_QUADS);

    tiny3d_VertexPos(x     , y     , z);

    tiny3d_VertexTexture(0.0f, 0.0f);
    

    tiny3d_VertexPos(x + dx, y     , z);
    tiny3d_VertexTexture(0.99f, 0.0f);
   

    tiny3d_VertexPos(x + dx, y + dy, z);
    tiny3d_VertexTexture(0.99f, 0.99f);
  
    tiny3d_VertexPos(x     , y + dy, z);
    tiny3d_VertexTexture(0.0f, 0.99f);
    

    tiny3d_End();
}
Пример #12
0
void BoxBrowser::DrawSurface()
{
	//vars
	VECTOR fr;
	VECTOR fl;
	VECTOR bl;
	VECTOR br;

	fl.x = -1400;
	fl.y = 500;
	fl.z = -500;

	fr.x = -fl.x;
	fr.y = fl.y;
	fr.z = fl.z;

	br.x = fr.x;
	br.y = 200;
	br.z = 0xffff;

	bl.x = fl.x;
	bl.y = br.y;
	bl.z = br.z;

	u32 rgba = 0x141414ff;

	//start drawing
	tiny3d_SetPolygon( TINY3D_QUADS );

	tiny3d_VertexPosVector( fl );
	tiny3d_VertexColor( rgba );
	tiny3d_VertexPosVector( fr );
	tiny3d_VertexPosVector( br );
	tiny3d_VertexPosVector( bl );

	tiny3d_End();
}
Пример #13
0
void tiny3d_Clear(u32 color, clear_flags flags)
{

    flag_vertex |= VERTEX_LOCK;

    render_target.target = 0;

    if(flags & TINY3D_CLEAR_COLOR) {
       
        tiny3d_Project2D();

        tiny3d_SetProjectionMatrix(&matrix_ident);
        tiny3d_SetMatrixModelView(&matrix_ident);
        
        internal_reality_ZControl(context, 0, 1, 1); // disable viewport culling
 
        internal_reality_DepthTestFunc(context, REALITY_ZFUNC_LESSOREQUAL);
        internal_reality_DepthWriteEnable(context, 1);
        internal_reality_DepthTestEnable(context, 1);

        internal_reality_AlphaEnable(context, 0);

        internal_reality_BlendEnable(context, 0);

        internal_reality_Viewport(context, Video_Resolution.width, Video_Resolution.height);
        
        
      
        int n;
       
        for(n = 0; n < 8; n++)
            {
            
            internal_reality_ViewportClip(context, n, Video_Resolution.width, Video_Resolution.height);
            }

        setupRenderTarget(Video_currentBuffer);

        rsxSetClearColor(context, color);

    }

    if(flags & TINY3D_CLEAR_ZBUFFER) {

        rsxSetClearDepthValue(context, 0xffffffff);
    }

    internal_reality_ClearBuffers(context, flags);

    if((flags & TINY3D_CLEAR_COLOR) && tiny_3d_alarm) {
        
        tiny3d_SetPolygon(TINY3D_QUADS);

        tiny3d_VertexPos(848/2  , 0  ,  65535);
        tiny3d_VertexColor(0xff0000ff);

        tiny3d_VertexPos(847, 0  , 65535);

        tiny3d_VertexPos(847, 511, 65535);

        tiny3d_VertexPos(848/2 , 511, 65535);
        tiny3d_End();

        internal_reality_Viewport(context, Video_Resolution.width*15/16, Video_Resolution.height);
        int n;
        for(n = 0; n < 8; n++)
            internal_reality_ViewportClip(context, n, Video_Resolution.width*15/16, Video_Resolution.height);
        internal_reality_ClearBuffers(context, flags);
    }
}