cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r125 - trunk/skorpion


From: will
Subject: [cinvoke-svn] r125 - trunk/skorpion
Date: 18 Nov 2006 02:15:17 -0500

Author: vmy
Date: 2006-11-18 02:15:13 -0500 (Sat, 18 Nov 2006)
New Revision: 125

Modified:
   trunk/skorpion/skorpion.cs
Log:
thruster moves in harmony with ship; thrusters still disabled

Modified: trunk/skorpion/skorpion.cs
===================================================================
--- trunk/skorpion/skorpion.cs  2006-11-17 05:31:06 UTC (rev 124)
+++ trunk/skorpion/skorpion.cs  2006-11-18 07:15:13 UTC (rev 125)
@@ -487,6 +487,36 @@
                        Assets.RenderAsset(iDevice, s.Asset, s.Texture);
                }
 
+               public void DrawThrusters(Ship s)
+               {       
+                       Vector3 ort = s.Orientation;
+                       ort.Normalize();
+
+                       Vector3 up = s.UpDirection;
+                       up.Normalize();
+
+                       Vector3 right = Vector3.Cross(ort, up);
+                       right.Normalize();
+
+                       Vector3 v2 = s.Position + (s.Orientation * -5.5f) + 
(s.UpDirection * 10.5f);
+                       Vector3 v = new Vector3(s.Orientation.X, 
s.Orientation.Y, s.Orientation.Z);
+                                               
+                       v.Scale(100);
+                                               
+                       iThrusterParticleSystem.Update(.03F,
+                               g_clrColor[(int)iThrusterParticleColor],
+                               g_clrColorFade[(int)iThrusterParticleColor],
+                               v2, v);
+                       iDevice.RenderState.ZBufferWriteEnable = false;
+                       iDevice.RenderState.AlphaBlendEnable = true;
+                       iDevice.RenderState.SourceBlend = Blend.One;
+                       iDevice.RenderState.DestinationBlend = Blend.One;
+                       iDevice.SetTexture(0, iThrusterParticleTexture);
+                       iThrusterParticleSystem.Render(iDevice);
+                       iDevice.RenderState.ZBufferWriteEnable = true;
+                       iDevice.RenderState.AlphaBlendEnable = false;
+               }
+
                public void Render()
                {
                        Ship Me = GlobalState.Client.Me;
@@ -549,35 +579,6 @@
                        iDevice.RenderState.Lighting = true;
                        iDevice.RenderState.ZBufferEnable = true;
 
-                       // draw pulsating thruster on ship
-                       foreach(Entity e2 in 
GlobalState.Client.ThisFrame.Values)
-                       {
-                               if (e2.Type == Ship.TYPE)
-                               {       
-                                       iDevice.Transform.World = 
Matrix.Translation(0f, 0f, 0f);
-                                       
-                                       if (ClientConfig.Thrusters) 
-                                       {
-                                               Ship s = (Ship)e2;
-                                               Vector3 v = new 
Vector3(s.Orientation.X, s.Orientation.Y, s.Orientation.Z);
-                                               
-                                               v.Scale(100);
-                                               
iThrusterParticleSystem.Update(.03F,
-                                                       
g_clrColor[(int)iThrusterParticleColor],
-                                                       
g_clrColorFade[(int)iThrusterParticleColor],
-                                                       new 
Vector3(e2.Position.X, e2.Position.Y, e2.Position.Z), v);
-                                               
iDevice.RenderState.ZBufferWriteEnable = false;
-                                               
iDevice.RenderState.AlphaBlendEnable = true;
-                                               iDevice.RenderState.SourceBlend 
= Blend.One;
-                                               
iDevice.RenderState.DestinationBlend = Blend.One;
-                                               iDevice.SetTexture(0, 
iThrusterParticleTexture);
-                                               
iThrusterParticleSystem.Render(iDevice);
-                                               
iDevice.RenderState.ZBufferWriteEnable = true;
-                                               
iDevice.RenderState.AlphaBlendEnable = false;
-                                       }
-                               }
-                       }
-
                        // draw sparks erupting from the ball
                        foreach(Entity e2 in 
GlobalState.Client.ThisFrame.Values)
                                //foreach(Entity e in 
(Entity)GlobalState.Client.Universe.Entities[2])
@@ -724,6 +725,54 @@
                                DrawShip(Me);
                        iDevice.RenderState.AlphaBlendEnable = false;
 
+                       iDevice.RenderState.Lighting = false;
+                       iDevice.RenderState.ZBufferEnable = false;
+                       iDevice.RenderState.CullMode = Cull.Clockwise;
+                       iDevice.TextureState[0].ColorOperation = 
TextureOperation.SelectArg1;
+                       iDevice.TextureState[0].ColorArgument1 = 
TextureArgument.TextureColor;
+                       iDevice.SetTexture(0, iStarTexture);
+                       iStars.DrawSubset(0);
+                       iDevice.RenderState.Lighting = true;
+                       iDevice.RenderState.ZBufferEnable = true;
+
+                       if(ClientConfig.Thrusters)
+                       {
+                               // draw pulsating thruster on ship
+                               foreach(Entity e2 in 
GlobalState.Client.ThisFrame.Values)
+                               {
+                                       if (e2.Type == Ship.TYPE)
+                                       {       
+                                               iDevice.Transform.World = 
Matrix.Translation(0f, 0f, 0f);
+                                       
+                                               Ship s = (Ship)e2;
+                                               if (e2.ID == Me.ID) s = Me;
+                                               DrawThrusters(s);
+                                               break;
+#if false
+                                       if (ClientConfig.Thrusters) 
+                                       {
+                                               Ship s = (Ship)e2;
+                                               Vector3 v = new 
Vector3(s.Orientation.X, s.Orientation.Y, s.Orientation.Z);
+                                               
+                                               v.Scale(100);
+                                               
iThrusterParticleSystem.Update(.03F,
+                                                       
g_clrColor[(int)iThrusterParticleColor],
+                                                       
g_clrColorFade[(int)iThrusterParticleColor],
+                                                       new 
Vector3(e2.Position.X, e2.Position.Y, e2.Position.Z), v);
+                                               
iDevice.RenderState.ZBufferWriteEnable = false;
+                                               
iDevice.RenderState.AlphaBlendEnable = true;
+                                               iDevice.RenderState.SourceBlend 
= Blend.One;
+                                               
iDevice.RenderState.DestinationBlend = Blend.One;
+                                               iDevice.SetTexture(0, 
iThrusterParticleTexture);
+                                               
iThrusterParticleSystem.Render(iDevice);
+                                               
iDevice.RenderState.ZBufferWriteEnable = true;
+                                               
iDevice.RenderState.AlphaBlendEnable = false;
+                                       }
+#endif
+                                       }
+                               }
+                       }
+
                        GlobalState.Console.Render();
                        GlobalState.Chat.Render();
                        GlobalState.PlayerList.Render();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]