Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /// <summary>
  2.         /// Helper function sets up the graphics device and
  3.         /// effect ready for drawing instanced geometry.
  4.         /// </summary>
  5.         void SetRenderStates(InstancingTechnique instancingTechnique,
  6.                              Matrix view, Matrix projection)
  7.         {
  8.             // Set the graphics device to use our vertex data.
  9.             graphicsDevice.VertexDeclaration = vertexDeclaration;
  10.             graphicsDevice.Vertices[0].SetSource(vertexBuffer, 0, vertexStride);
  11.             graphicsDevice.Indices = indexBuffer;
  12.  
  13.             // Make sure our effect is set to use the right technique.
  14.             if (techniqueChanged)
  15.             {
  16.                 string techniqueName = instancingTechnique.ToString();
  17.                 effect.CurrentTechnique = effect.Techniques[techniqueName];
  18.                 techniqueChanged = false;
  19.             }
  20.  
  21.             // Pass camera matrices through to the effect.
  22.             effect.Parameters["View"].SetValue(view);
  23.             effect.Parameters["Projection"].SetValue(projection);
  24.             //effect.Parameters["TargetColor"].SetValue(Color.Green.ToVector3());