home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / ShaderChange.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  2.3 KB  |  101 lines

  1. G.SetGroup( "Cam" )
  2. local Cam = G.Create( "Data/BasicCamera.xml");
  3. local pos = Vector3(50,60,50);
  4. Cam.SetPosition( pos );
  5.  
  6. MCog = G.Create( "Data/ModelCog.xml" );
  7. MCog.SetPosition( Vector3(90,10,90) );
  8. MCog.SetAnimation( "Fire" );
  9.  
  10. Obj = G.Create( "Data/KnotCog.xml" );
  11. Obj.SetPosition( Vector3(90, 0 , 90) );
  12.  
  13. Obj = G.Create( "Data/PlaneCog.xml" );
  14. Obj.SetPosition( Vector3(90,0,90) );
  15.  
  16. Obj = G.Create( "Data/LightCog.xml"  );
  17. Obj.SetPosition( Vector3(90, 16 , 90) );
  18.  
  19. shaderindex = 0;
  20. shaders = {};
  21. shaders[0] = "Basic";
  22. shaders[1] = "VertSpec";
  23. shaders[2] = "Mem";
  24. shaders[3] = "Spec";
  25. shaders[4] = "ViewShine";
  26.  
  27. bshaderindex = 0;
  28. bshaders = {};
  29. bshaders[0] = "Para";
  30. bshaders[1] = "Bump";
  31.  
  32. function ShaderChange()
  33.  
  34.     if( G.KeyTriggered( "Q" ) ) then
  35.         local PCog = G.Create( "Data/LargeExplo.xml" );
  36.         --local PCog = G.Create( "Data/SmallFireEffect.xml" );
  37.         PCog.SetPosition( Vector3(80,50,80) );
  38.     end
  39.     
  40.     
  41.     if( G.MouseTriggered( 2 )  ) then
  42.         local pObj = G.ScreenPick();
  43.  
  44.         if( pObj.IsValid() ) then
  45.             TargetPos = pObj.GetPosition();
  46.             G.GenIK( MCog , TargetPos );
  47.         end
  48.         
  49.     end
  50.     
  51.     if( G.MouseTriggered( 0 )  ) then
  52.         MCog = G.ScreenPick();
  53.     end
  54.             
  55.     --if( G.KeyTriggered( "I" ) and TargetPos ) then    
  56.     --pObj.Destroy();    
  57.     --end    
  58.         
  59.     if( G.KeyTriggered( "G" )  ) then
  60.         
  61.         if( shaders[ shaderindex ]  ) then
  62.             MCog.SetShader( shaders[ shaderindex ] );
  63.             shaderindex = shaderindex + 1
  64.         else
  65.             shaderindex = 0;
  66.             MCog.SetShader( shaders[ shaderindex ] );
  67.             shaderindex = shaderindex + 1        
  68.         end    
  69.     end
  70.     
  71.     if( G.KeyTriggered( "H" )  ) then        
  72.         MCog.CycleAnimation();    
  73.     end
  74.         
  75.     if( G.KeyTriggered( "B" ) ) then
  76.         
  77.         if( bshaders[ bshaderindex ]  ) then
  78.             local MCog = G.GetCogName( "PlaneCog" );
  79.             MCog.SetShader( bshaders[ bshaderindex ] );
  80.             bshaderindex = bshaderindex + 1
  81.         else
  82.             bshaderindex = 0;
  83.             local MCog = G.GetCogName( "PlaneCog" );
  84.             MCog.SetShader( bshaders[ bshaderindex ] );
  85.             bshaderindex = bshaderindex + 1        
  86.         end
  87.     
  88.     end    
  89. end
  90.  
  91. function DooDad()
  92.     if( G.KeyTriggered( "F" ) ) then
  93.         local d = G.Create( "Data/LargePineTree.xml" );
  94.         local mpos = G.GetTerrainIntersection();
  95.         d.SetPosition( mpos );
  96.     end            
  97. end            
  98.             
  99. GMain[ "DooDad" ] = DooDad;        
  100. GMain[ "ShaderChange" ] = ShaderChange;
  101.