Exemplo n.º 1
0
        void RenderExternal(AlphaPool ap, GameCamera gcam)
        {
            foreach (StaticMeshComp smc in mStaticComps)
            {
                StaticMesh sm = smc.mDrawObject as StaticMesh;
                if (sm == null)
                {
                    continue;
                }

                if (!mVisibleSMC.Contains(smc))
                {
                    continue;
                }

                SetTriLightForSMC(smc);

                sm.SetTransform(smc.mMat);
                sm.Draw(mGD.DC, mStaticMats);
            }

            if (mPMeshLighting == null)
            {
                return;
            }

            Vector4 lightCol0, lightCol1, lightCol2;
            Vector3 lightPos, lightDir;
            bool    bDir;
            float   intensity;

            mPMeshLighting.GetCurrentValues(
                out lightCol0, out lightCol1, out lightCol2,
                out intensity, out lightPos, out lightDir, out bDir);

            if (mPChar != null)
            {
                mPMats.SetTriLightValues(lightCol0, lightCol1, lightCol2, lightDir);
                mPChar.Draw(mGD.DC, mPMats);
            }

            mPB.Draw(ap, gcam.View, gcam.Projection);
        }
Exemplo n.º 2
0
 public static int Main(string[] args)
 {
     Console.WriteLine("Thread Pool Sample:");
     bool W2K = false;
     int MaxCount = 10;  // Allow a total of 10 threads in the pool
     // Mark the event as unsignaled.
     ManualResetEvent eventX = new ManualResetEvent(false);
     Console.WriteLine("Queuing {0} items to Thread Pool", MaxCount);
     AlphaPool oAlpha = new AlphaPool(MaxCount);  // Create the work items.
     // Make sure the work items have a reference to the signaling event.
     oAlpha.eventX = eventX;
     Console.WriteLine("Queue to Thread Pool 0");
     try
     {
         // Queue the work items, which has the added effect of checking
         // which OS is running.
         ThreadPool.QueueUserWorkItem(new WaitCallback(oAlpha.Beta),
            new SomeState(0));
         W2K = true;
     }
     catch (NotSupportedException)
     {
         Console.WriteLine("These API's may fail when called on a non-Windows 2000 system.");
         W2K = false;
     }
     if (W2K)  // If running on an OS which supports the ThreadPool methods.
     {
         for (int iItem = 1; iItem < MaxCount; iItem++)
         {
             // Queue the work items:
             Console.WriteLine("Queue to Thread Pool {0}", iItem);
             ThreadPool.QueueUserWorkItem(new WaitCallback(oAlpha.Beta), new SomeState(iItem));
         }
         Console.WriteLine("Waiting for Thread Pool to drain");
         // The call to exventX.WaitOne sets the event to wait until
         // eventX.Set() occurs.
         // (See oAlpha.Beta).
         // Wait until event is fired, meaning eventX.Set() was called:
         eventX.WaitOne(Timeout.Infinite, true);
         // The WaitOne won't return until the event has been signaled.
         Console.WriteLine("Thread Pool has been drained (Event fired)");
         Console.WriteLine();
         Console.WriteLine("Load across threads");
         foreach (object o in oAlpha.HashCount.Keys)
             Console.WriteLine("{0} {1}", o, oAlpha.HashCount[o]);
     }
     return 0;
 }
Exemplo n.º 3
0
 void RenderExternal(AlphaPool ap, GameCamera gcam)
 {
 }