[Transition] Taskswitch.tra
#1
This one is inspired by the Vista-Taskswitch (i dont know how the topmost window gets to the back, so i created my own way)

PHP Code:
// Taskswitch.tra
// Author - morte0815

float time;
Texture background;

void Init()
{
  
time 0;
  
background.LoadTexture("Plasma_edge.jpg");

}

void DrawFrame()
{
  
gfxSetTexture(background);
  
gfxTexRect(-1.1f1.1f1.1f, -1.1f);   
}

void TexRect(float topfloat bottomfloat leftfloat right
float ttopfloat tbottomfloat tleftfloat tright)
{
  
gfxBegin(PRIM_QUADLIST);
    
gfxTexCoord(tleft,ttop);
    
gfxVertex(left,top,0);
    
gfxTexCoord(tright,ttop);
    
gfxVertex(right,top,0);
    
gfxTexCoord(tright,tbottom);
    
gfxVertex(right,bottom,0);
    
gfxTexCoord(tleft,tbottom);
    
gfxVertex(left,bottom,0); 
  
gfxEnd();
}

void Render()
{

gfxSetAspect(0);
  
time += TIMEPASS;
//   gfxSetBlendMode(BLEND_ADD);
//   float angle = time - 1.5f;
//   if (angle < 0){ angle = -angle;}
//   angle = 1.5f - angle; 
//   gfxRotate(Pow(360,angle*2),0,0,1);
     
if (time 1.0f){
       
gfxTranslate(002.414+time*2);
       
gfxRotate(-65*time,0,1,0);
       
gfxTranslate(00, -time/2.0f);
       
gfxPushMatrix();
       
       
       
gfxTranslate(001);
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
gfxTexRect(-111, -1);
   } 
   if (
time 1.0f && time 2.0f)
   {
      
gfxTranslate(004.414);
      
gfxRotate(-65,0,1,0);
      
gfxTranslate(00, -0.5f);
       
gfxPushMatrix();
       
       
gfxTranslate(001-(time-1));
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
gfxPushMatrix();
       
gfxTranslate(0,(time-1)*2,0);
       
gfxSetTexture(background);
       
TexRect(1.1f,0.0f,-1.1f,1.1f,1.0f,0.5f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(1,0,-1,1,1.0f,0.5f,0.0f,1.0f);
       
       
gfxPopMatrix();
       
gfxTranslate(0,(1-time)*2,0);
       
gfxSetTexture(background);
       
TexRect(0.0f,-1.1f,-1.1f,1.1f,0.5f,0.0f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(0,-1,-1,1,0.5f,0.0f,0.0f,1.0f);
   }
    if (
time 2.0f)
   {
      
gfxTranslate(004.414-(time-2)*2);
      
gfxRotate(-65+(time-2)*65,0,1,0);
      
gfxTranslate(00, -0.5f);
       
gfxPushMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
      
   }

  if (
time>=3){
    
FINISHED true;
  }
        


In this one there is still a bug (the textures tear when the splitted window is shifted away), but i dont know why, so i cant fix it. Maybe someone else finds the bug.

Cya
Reply
#2
Shocked Outstanding! Shocked

I didn't notice any tearing here.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
MrC Wrote:Shocked Outstanding! Shocked

I didn't notice any tearing here.
THANKS!!

You can see the tearing if you use this version (it stops at the splitting of the current visualization):
PHP Code:
// Taskswitch_tearing.tra
// Author - morte0815

float time;
Texture background;

void Init()
{
  
time 0;
  
background.LoadTexture("Plasma_edge.jpg");

}

void DrawFrame()
{
  
gfxSetTexture(background);
  
gfxTexRect(-1.1f1.1f1.1f, -1.1f);   
}

void TexRect(float topfloat bottomfloat leftfloat right
float ttopfloat tbottomfloat tleftfloat tright)
{
  
gfxBegin(PRIM_QUADLIST);
    
gfxTexCoord(tleft,ttop);
    
gfxVertex(left,top,0);
    
gfxTexCoord(tright,ttop);
    
gfxVertex(right,top,0);
    
gfxTexCoord(tright,tbottom);
    
gfxVertex(right,bottom,0);
    
gfxTexCoord(tleft,tbottom);
    
gfxVertex(left,bottom,0); 
  
gfxEnd();
}

void Render()
{

gfxSetAspect(0);
  
time += TIMEPASS;
//   gfxSetBlendMode(BLEND_ADD);
//   float angle = time - 1.5f;
//   if (angle < 0){ angle = -angle;}
//   angle = 1.5f - angle; 
//   gfxRotate(Pow(360,angle*2),0,0,1);
     
if (time 1.0f){
       
gfxTranslate(002.414+time*2);
       
gfxRotate(-65*time,0,1,0);
       
gfxTranslate(00, -time/2.0f);
       
gfxPushMatrix();
       
       
       
gfxTranslate(001);
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
gfxTexRect(-111, -1);
   } 
   if (
time 1.0f )
   {
      
gfxTranslate(004.414);
      
gfxRotate(-65,0,1,0);
      
gfxTranslate(00, -0.5f);
       
gfxPushMatrix();
       
       
gfxTranslate(001);
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
gfxPushMatrix();
       
gfxTranslate(0,0,0);
       
gfxSetTexture(background);
       
TexRect(1.1f,0.0f,-1.1f,1.1f,1.0f,0.5f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(1,0,-1,1,1.0f,0.5f,0.0f,1.0f);
       
       
gfxPopMatrix();
       
gfxTranslate(0,0,0);
       
gfxSetTexture(background);
       
TexRect(0.0f,-1.1f,-1.1f,1.1f,0.5f,0.0f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(0,-1,-1,1,0.5f,0.0f,0.0f,1.0f);
   }

  if (
time>=3){
    
FINISHED true;
  }
        

Reply
#4
maybe add some randomness so it does the transition in more than direction ? Smile
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Since i cant edit my posts anymore (ADMIN!!!!!!!! Laugh) here is a version with some randomnes:

PHP Code:
// taskswitch.tra
// Author - morte0815

float time;
Texture background;
float angleA;
float angleB;
float vertical;


void Init()
{
  
time 0;
  
background.LoadTexture("Plasma_edge.jpg");
  
angleA Rand() * 180 90;
  
angleB Rand() * 180 90;
  
vertical Rand();
}

void DrawFrame()
{
  
gfxSetTexture(background);
  
gfxTexRect(-1.1f1.1f1.1f, -1.1f);   
}

void TexRect(float topfloat bottomfloat leftfloat right
float ttopfloat tbottomfloat tleftfloat tright)
{
  
gfxBegin(PRIM_QUADLIST);
    
gfxTexCoord(tleft,ttop);
    
gfxVertex(left,top,0);
    
gfxTexCoord(tright,ttop);
    
gfxVertex(right,top,0);
    
gfxTexCoord(tright,tbottom);
    
gfxVertex(right,bottom,0);
    
gfxTexCoord(tleft,tbottom);
    
gfxVertex(left,bottom,0); 
  
gfxEnd();
}

void Render()
{

gfxSetAspect(0);
  
time += TIMEPASS;
     if (
time 1.0f){
       
gfxTranslate(002.414+time*2);
       
gfxRotate(angleA*time,0,1,0);
       
gfxRotate(angleB*time,1,0,0);
       
gfxTranslate(00, -time/2.0f);
       
gfxPushMatrix();
       
       
       
gfxTranslate(001);
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
gfxTexRect(-111, -1);
   } 
   if (
time 1.0f && time 2.0f)
   {
      
gfxTranslate(004.414);
      
gfxRotate(angleA,0,1,0);
       
gfxRotate(angleB,1,0,0);
      
gfxTranslate(00, -0.5f);
       
gfxPushMatrix();
       
       
gfxTranslate(001-(time-1));
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
gfxPushMatrix();
       if (
vertical >0.5f){
        
gfxTranslate(0,(time-1)*2,0);
       }
       else{
        
gfxTranslate((time-1)*2,0,0);
       }
       
gfxSetTexture(background);
       
TexRect(1.1f,0.0f,-1.1f,1.1f,0.0f,0.5f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(1,0,-1,1,0.0f,0.5f,0.0f,1.0f);
       
       
gfxPopMatrix();
       if (
vertical>0.5f){
        
gfxTranslate(0,(1-time)*2,0);
       }
       else{
        
gfxTranslate((1-time)*2,0,0);
       }
       
gfxSetTexture(background);
       
TexRect(0.0f,-1.1f,-1.1f,1.1f,0.5f,1.0f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(0,-1,-1,1,0.5f,1.0f,0.0f,1.0f);
   }
    if (
time 2.0f)
   {
      
gfxTranslate(004.414-(time-2)*2);
      
gfxRotate(angleA+(time-2)*-angleA,0,1,0);
      
gfxRotate(angleB+(time-2)*-angleB,1,0,0);
      
gfxTranslate(00, -0.5f);
       
gfxPushMatrix();
       
        if (
vertical>0.5f){
        
gfxTranslate(0,(time-1)*2,0);
       }
       else{
        
gfxTranslate((time-1)*2,0,0);
       }
       
gfxSetTexture(background);
       
TexRect(1.1f,0.0f,-1.1f,1.1f,0.0f,0.5f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(1,0,-1,1,0.0f,0.5f,0.0f,1.0f);
       
       
gfxPopMatrix();
       
gfxPushMatrix();
       
       if (
vertical>0.5f){
        
gfxTranslate(0,(1-time)*2,0);
       }
       else{
        
gfxTranslate((1-time)*2,0,0);
       }
       
gfxSetTexture(background);
       
TexRect(0.0f,-1.1f,-1.1f,1.1f,0.5f,1.0f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(0,-1,-1,1,0.5f,1.0f,0.0f,1.0f);
       
       
gfxPopMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
      
   }
  if (
time>=3){
    
FINISHED true;
  }
        

Reply
#6
When it splits the current preset the textures coords are wrong and it draws it upside down. I am not sure if this is the tearing you are talking about or not. Anyway, the fixed version is below. I have also removed a few gfxTranslate functions as it was jumping at the end due to not being at the correct z position. You will probably have a better idea how to fix that than me.

PHP Code:
// Taskswitch.tra
// Author - morte0815

float time;
Texture background;

void Init()
{
  
time 0;
  
background.LoadTexture("Plasma_edge.jpg");

}

void DrawFrame()
{
  
gfxSetTexture(background);
  
gfxTexRect(-1.1f1.1f1.1f, -1.1f);   
}

void TexRect(float topfloat bottomfloat leftfloat right
float ttopfloat tbottomfloat tleftfloat tright)
{
  
gfxBegin(PRIM_QUADLIST);
    
gfxTexCoord(tleft,ttop);
    
gfxVertex(left,top,0);
    
gfxTexCoord(tright,ttop);
    
gfxVertex(right,top,0);
    
gfxTexCoord(tright,tbottom);
    
gfxVertex(right,bottom,0);
    
gfxTexCoord(tleft,tbottom);
    
gfxVertex(left,bottom,0); 
  
gfxEnd();
}

void Render()
{

gfxSetAspect(0);
  
time += TIMEPASS;
//   gfxSetBlendMode(BLEND_ADD);
//   float angle = time - 1.5f;
//   if (angle < 0){ angle = -angle;}
//   angle = 1.5f - angle; 
//   gfxRotate(Pow(360,angle*2),0,0,1);
     
if (time 1.0f){
       
gfxTranslate(002.414+time*2);
       
gfxRotate(-65*time,0,1,0);
//       gfxTranslate(0, 0, -time/2.0f);
       
gfxPushMatrix();
       
       
       
gfxTranslate(001);
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
gfxTexRect(-111, -1);
   } 
   if (
time 1.0f && time 2.0f)
   {
      
gfxTranslate(004.414);
      
gfxRotate(-65,0,1,0);
//      gfxTranslate(0, 0, -0.5f);
       
gfxPushMatrix();
       
       
gfxTranslate(001-(time-1));
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
       
       
       
gfxPopMatrix();
       
gfxPushMatrix();
       
gfxTranslate(0,(time-1)*2,0);
       
gfxSetTexture(background);
       
TexRect(1.1f,0.0f,-1.1f,1.1f,1.0f,0.5f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(1,0,-1,1,0.0f,0.5f,0.0f,1.0f);
       
       
gfxPopMatrix();
       
gfxTranslate(0,(1-time)*2,0);
       
gfxSetTexture(background);
       
TexRect(0.0f,-1.1f,-1.1f,1.1f,0.5f,0.0f,0.0f,1.0f);
       
gfxSetTexture(TEXTURE_CURRPRESET);
       
TexRect(0,-1,-1,1,0.5f,1.0f,0.0f,1.0f);
   }
    if (
time 2.0f)
   {
      
gfxTranslate(004.414-(time-2)*2);
      
gfxRotate(-65+(time-2)*65,0,1,0);
//      gfxTranslate(0, 0, -0.5f);
       
gfxPushMatrix();
       
       
DrawFrame();
       
gfxSetTexture(TEXTURE_NEXTPRESET);
       
gfxTexRect(-111, -1);
      
   }

  if (
time>=3){
    
FINISHED true;
  }
        

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply

Logout Mark Read Team Forum Stats Members Help
[Transition] Taskswitch.tra2