本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexDeclaration类的典型用法代码示例。如果您正苦于以下问题:C# VertexDeclaration类的具体用法?C# VertexDeclaration怎么用?C# VertexDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertexDeclaration类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了VertexDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create
public override void Create()
{
buffer = Plane(xCount, yCount);
//Load the correct shader and set up the parameters
IGraphicsDeviceService graphicsService = (IGraphicsDeviceService)GameInstance.Services.GetService(typeof(IGraphicsDeviceService));
effect = SpacewarGame.ContentManager.Load<Effect>(SpacewarGame.Settings.MediaPath + @"shaders\sun");
worldParam = effect.Parameters["world"];
worldViewProjectionParam = effect.Parameters["worldViewProjection"];
sun0TextureParam = effect.Parameters["Sun_Tex0"];
sun1TextureParam = effect.Parameters["Sun_Tex1"];
blendFactor = effect.Parameters["blendFactor"];
//Preload the textures into the cache
int numFrames = 5;
sun = new Texture2D[numFrames];
sun[0] = SpacewarGame.ContentManager.Load<Texture2D>(SpacewarGame.Settings.MediaPath + @"textures\suntest1");
sun[1] = SpacewarGame.ContentManager.Load<Texture2D>(SpacewarGame.Settings.MediaPath + @"textures\suntest2");
sun[2] = SpacewarGame.ContentManager.Load<Texture2D>(SpacewarGame.Settings.MediaPath + @"textures\suntest3");
sun[3] = SpacewarGame.ContentManager.Load<Texture2D>(SpacewarGame.Settings.MediaPath + @"textures\suntest4");
sun[4] = SpacewarGame.ContentManager.Load<Texture2D>(SpacewarGame.Settings.MediaPath + @"textures\suntest5");
vertexDecl = new VertexDeclaration(graphicsService.GraphicsDevice, VertexPositionColor.VertexElements);
}
开发者ID:gitaishhub,项目名称:cs4803mpg,代码行数:27,代码来源:EvolvedSun.cs
示例2: CreateVertexBuffer
private void CreateVertexBuffer()
{
vertexDeclaration = new VertexDeclaration(new VertexElement[1]
{
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0)
}
);
vertexBuffer = new VertexBuffer(
GraphicsDevice,
vertexDeclaration,
number_of_vertices,
BufferUsage.None
);
Vector3[] vertices = new Vector3[number_of_vertices];
vertices[0] = new Vector3(-1, 0, 0); // cw
vertices[1] = new Vector3(0, 1, 0);
vertices[2] = new Vector3(0, 0, 0);
vertices[3] = new Vector3(0, 0, 0); // ccw
vertices[4] = new Vector3(1, 0, 0);
vertices[5] = new Vector3(0, 1, 0);
vertexBuffer.SetData(vertices);
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:26,代码来源:Game1.cs
示例3: LoadContent
public void LoadContent()
{
#if gradient
generateTextureEffect = game.Content.Load<Effect>(@"effects\GenerateTerrainTextureGradient");
gradientTexture = game.Content.Load<Texture2D>(@"textures\gradient_01");
generateTextureEffect.Parameters["gradient"].SetValue(gradientTexture);
#else
string[] textureNames = {
"dirt_01", "dirt_03",
"sand_02", "sand_03",
"grass_01", "grass_02", "grass_03",
"water_01", "stone_02", "stone_03",
"snow_01", "snow_03"
};
generateTextureEffect = game.Content.Load<Effect>(@"effects\GenerateTerrainTexturePack");
slopemapTexture = game.Content.Load<Texture2D>(@"textures\slopemap");
// load diffuse textures
textures = new Texture2D[textureNames.Length];
for (int i = 0; i < textures.Length; i++)
textures[i] = game.Content.Load<Texture2D>(@"textures\" + textureNames[i]);
#endif
// texture declaration
vertexPositionTexture = VertexPositionTexture.VertexDeclaration; // new VertexDeclaration(device, VertexPositionTexture.VertexElements);
}
开发者ID:TrinityGaming,项目名称:Planet_40,代码行数:31,代码来源:TerrainTextureGenerator.cs
示例4: WheelMenuEntry
WheelMenu wheel; // the parent wheel
#endregion Fields
#region Constructors
public WheelMenuEntry( WheelMenu wheel, Texture2D texture )
{
this.wheel = wheel;
this.texture = texture;
segments = 10;
extendedSpring = new SpringInterpolater( 1, 800, SpringInterpolater.GetCriticalDamping( 800 ) );
extendedSpring.SetSource( 0 );
extendedSpring.SetDest( 0 );
extendedSpring.Active = true;
growSpring = new SpringInterpolater( 1, 700, .25f * SpringInterpolater.GetCriticalDamping( 700 ) );
growSpring.SetSource( 0 );
growSpring.SetDest( 0 );
growSpring.Active = true;
float height = WheelMenu.EntryIdleSize;
float width = height * (float)texture.Width / (float)texture.Height;
GenerateVerts( width, height, segments, out idleVerts );
GenerateVerts( width * WheelMenu.EntryActiveScale, height * WheelMenu.EntryActiveScale, segments, out activeVerts );
vertexBuffer = new VertexPositionNormalTexture[( segments + 1 ) * 2];
vertexDeclaration = new VertexDeclaration( wheel.Screen.ScreenManager.GraphicsDevice,
VertexPositionNormalTexture.VertexElements );
}
开发者ID:yxrkt,项目名称:AvatarHamsterPanic,代码行数:32,代码来源:WheelMenuEntry.cs
示例5: LoadContent
public override void LoadContent()
{
vertexDecl = VertexPositionTexture.VertexDeclaration;
verts = new VertexPositionTexture[]
{
new VertexPositionTexture(
new Vector3(0,0,1),
new Vector2(1,1)),
new VertexPositionTexture(
new Vector3(0,0,1),
new Vector2(0,1)),
new VertexPositionTexture(
new Vector3(0,0,1),
new Vector2(0,0)),
new VertexPositionTexture(
new Vector3(0,0,1),
new Vector2(1,0))
};
ib = new short[] { 0, 1, 2, 2, 3, 0 }; // 0 -- 1
// | |
// 2 -- 3
base.LoadContent();
}
开发者ID:CC-Ricers,项目名称:XNA-4.0-Dual-Paraboloid-Reflection-Mapping,代码行数:26,代码来源:Quad.cs
示例6: LoadContent
public void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
{
if (_dEffect == null)
_dEffect = content.Load<Effect>("Content/Effects/Series4Effects");
_texture1 = content.Load<Texture2D>("Content/Textures/Ground/sand");
_texture2 = content.Load<Texture2D>("Content/Textures/Ground/grass");
_texture3 = content.Load<Texture2D>("Content/Textures/Ground/rock");
_texture4 = content.Load<Texture2D>("Content/Textures/Ground/snow");
_skyDome = content.Load<Model>("Content/Models/dome");
_skyDome.Meshes[0].MeshParts[0].Effect = _dEffect.Clone();
_cloudMap = content.Load<Texture2D>("Content/Models/cloudMap");
//PresentationParameters pp = _dDevice.PresentationParameters;
//refractionRenderTarget = new RenderTarget2D(_dDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, pp.BackBufferFormat, pp.DepthStencilFormat);
//reflectionRenderTarget = new RenderTarget2D(_dDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, pp.BackBufferFormat, pp.DepthStencilFormat);
SetUpWaterVertices();
waterBumpMap = content.Load<Texture2D>("Content/Textures/Ground/water");
VertexPositionTexture[] fullScreenVertices = SetUpFullscreenVertices();
//fullScreenVertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
VertexDeclaration vertexDeclaration = new VertexDeclaration(VertexMultitextured.VertexElements);
fullScreenBuffer = new VertexBuffer(_dDevice, vertexDeclaration, fullScreenVertices.Length, BufferUsage.WriteOnly);
fullScreenBuffer.SetData(fullScreenVertices);
fullScreenVertexDeclaration = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements());
}
开发者ID:mrommel,项目名称:MiRo.SimHexWorld,代码行数:32,代码来源:HexMesh.cs
示例7: Flush
public virtual void Flush()
{
if (this.vertexCount > 0)
{
if (this.declaration == null || this.declaration.IsDisposed)
this.declaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
device.VertexDeclaration = this.declaration;
Effect effect = this.Effect;
// set the only parameter this effect takes.
effect.Parameters["viewProjection"].SetValue(this.View * this.Projection);
EffectTechnique technique = effect.CurrentTechnique;
effect.Begin();
EffectPassCollection passes = technique.Passes;
for (int i = 0; i < passes.Count; i++)
{
EffectPass pass = passes[i];
pass.Begin();
device.DrawUserIndexedPrimitives<VertexPositionTexture>(
PrimitiveType.TriangleList, this.vertices, 0, this.vertexCount,
this.indices, 0, this.indexCount / 3);
pass.End();
}
effect.End();
this.vertexCount = 0;
this.indexCount = 0;
}
}
开发者ID:mikecann,项目名称:Portal2D-XNA,代码行数:33,代码来源:cPostProcessBatch.cs
示例8: loadContent
public void loadContent(ContentManager contentManager, GraphicsDeviceManager graphicsManager, ModelGeometry collisionGeometry)
{
mGraphicsDevice = graphicsManager.GraphicsDevice;
mInstanceVertexDeclaration = new VertexDeclaration(new[]
{
new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
new VertexElement(16, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
new VertexElement(32, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 4),
new VertexElement(48, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 5)
});
mCollidingFacesVertexDeclaration = new VertexDeclaration(new[]
{
// ideally we'd use Byte4 for Color0 but it's so much easier to fill vertex buffers with Vector3. There's only very little data anyway
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0 ),
new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0 ),
new VertexElement(24, VertexElementFormat.Vector3, VertexElementUsage.Color, 0 )
});
mCollidingFacesVertices = new VertexBuffer(mGraphicsDevice, mCollidingFacesVertexDeclaration, collisionGeometry.faces.Length * 3, BufferUsage.WriteOnly);
// load collisions shader and configure material properties
mCollisionsShader = contentManager.Load<Effect>("Effects/CollisionsShader");
mCollisionsShader.Parameters["MaterialColor"].SetValue(new Vector3(0.39f, 0.8f, 1f));
mAlphaBlendState = new BlendState();
mAlphaBlendState.ColorSourceBlend = Blend.SourceAlpha;
mAlphaBlendState.AlphaSourceBlend = Blend.SourceAlpha;
mAlphaBlendState.ColorDestinationBlend = Blend.InverseSourceAlpha;
mAlphaBlendState.AlphaDestinationBlend = Blend.InverseSourceAlpha;
}
开发者ID:xboxlife,项目名称:xna-bounce,代码行数:32,代码来源:Renderer.cs
示例9: SkyBox
public SkyBox(ContentReader input)
{
// Graphics Device-Instanz abrufen
this.GraphicsDevice = ((IGraphicsDeviceService)input.ContentManager.ServiceProvider.GetService(typeof(IGraphicsDeviceService))).GraphicsDevice;
// Vertices einlesen und Vertex Buffer initialisieren
VertexPositionTexture[] vertices = input.ReadObject<VertexPositionTexture[]>();
this.vertexBuffer = new VertexBuffer(this.GraphicsDevice, typeof(VertexPositionTexture), vertices.Length, BufferUsage.None);
this.vertexBuffer.SetData<VertexPositionTexture>(vertices);
// Anzahl der Vertices speichern
this.numVertices = vertices.Length;
// Division durch 3 ergibt die Anzahl der Primitive, da eine Dreiecksliste verwendet wird
this.numPrimitives = this.numPrimitives / 3;
// Vertex-Beschreibung erzeugen
this.vertexDeclaration = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements());
// BasicEffect-Instanz erzeugen
this.effect = new BasicEffect(this.GraphicsDevice);
// Texturen einlesen
this.frontTexture = input.ReadExternalReference<Texture2D>();
this.backTexture = input.ReadExternalReference<Texture2D>();
this.leftTexture = input.ReadExternalReference<Texture2D>();
this.rightTexture = input.ReadExternalReference<Texture2D>();
this.topTexture = input.ReadExternalReference<Texture2D>();
this.bottomTexture = input.ReadExternalReference<Texture2D>();
}
开发者ID:urmuelle,项目名称:MonoGameBallerburg,代码行数:30,代码来源:SkyBox.cs
示例10: VertexPositionColorTexture
static VertexPositionColorTexture()
{
VertexDeclaration = new VertexDeclaration(
new VertexElement[]
{
new VertexElement(
0,
VertexElementFormat.Vector3,
VertexElementUsage.Position,
0
),
new VertexElement(
12,
VertexElementFormat.Color,
VertexElementUsage.Color,
0
),
new VertexElement(
16,
VertexElementFormat.Vector2,
VertexElementUsage.TextureCoordinate,
0
)
}
);
}
开发者ID:BlueLineGames,项目名称:FNA,代码行数:26,代码来源:VertexPositionColorTexture.cs
示例11: VertexBufferObject
/// <summary>
/// Constructor of VertexBufferObject class
/// </summary>
/// <param name="device">Graphics device</param>
/// <param name="type">Type of buffer to use</param>
/// <param name="buffer">Underlying vertex buffer</param>
internal VertexBufferObject(GraphicsDevice device, BufferType type, VertexBuffer buffer)
{
_device = device;
_bufferType = type;
_vertexDeclaration = buffer.VertexDeclaration;
CreateWrapper(buffer);
}
开发者ID:Julien-Pires,项目名称:Pulsar,代码行数:13,代码来源:VertexBufferObject.cs
示例12: SkyplaneEngine
public SkyplaneEngine(InfiniminerGame gameInstance)
{
this.gameInstance = gameInstance;
// Generate a noise texture.
randGen = new Random();
texNoise = new Texture2D(gameInstance.GraphicsDevice, 64, 64);
uint[] noiseData = new uint[64*64];
for (int i = 0; i < 64 * 64; i++)
if (randGen.Next(32) == 0)
noiseData[i] = Color.White.PackedValue;
else
noiseData[i] = Color.Black.PackedValue;
texNoise.SetData(noiseData);
// Load the effect file.
effect = gameInstance.Content.Load<Effect>("effect_skyplane");
// Create our vertices.
vertexDeclaration = new VertexDeclaration(gameInstance.GraphicsDevice, VertexPositionTexture.VertexElements);
vertices = new VertexPositionTexture[6];
vertices[0] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0));
vertices[1] = new VertexPositionTexture(new Vector3(274, 100, -210), new Vector2(1, 0));
vertices[2] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1));
vertices[3] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0));
vertices[4] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1));
vertices[5] = new VertexPositionTexture(new Vector3(-210, 100, 274), new Vector2(0, 1));
}
开发者ID:GlennSandoval,项目名称:Infiniminer,代码行数:28,代码来源:SkyboxEngine.cs
示例13: Initialize
/// <summary>
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
/// </summary>
public override void Initialize()
{
int iWidth = graphics.Viewport.Width;
int iHeight = graphics.Viewport.Height;
for (int i = 0; i < DefaultBufferSize; i++)
{
vertices[i] = new VertexPositionColor();
vertices[i].Position.X = rand.Next(iWidth);
vertices[i].Position.Y = rand.Next(iHeight);
vertices[i].Color = Color.White; //new Color(128, 128, 128);
}
graphics.RenderState.PointSize = 1;
// create a vertex declaration, which tells the graphics card what kind of
// data to expect during a draw call. We're drawing using
// VertexPositionColors, so we'll use those vertex elements.
vertexDeclaration = new VertexDeclaration(graphics,
VertexPositionColor.VertexElements);
// set up a new basic effect, and enable vertex colors.
basicEffect = new BasicEffect(graphics, null);
basicEffect.VertexColorEnabled = true;
// projection uses CreateOrthographicOffCenter to create 2d projection
// matrix with 0,0 in the upper left.
basicEffect.Projection = Matrix.CreateOrthographicOffCenter
(0, iWidth,
iHeight, 0,
0, 1);
base.Initialize();
}
开发者ID:funkjunky,项目名称:Revenge-of-the-Morito-2-,代码行数:37,代码来源:StarryBackground.cs
示例14: QuadRenderComponent
// Constructor
public QuadRenderComponent(Game game)
: base(game)
{
IGraphicsDeviceService graphicsService =
(IGraphicsDeviceService)base.Game.Services.GetService(
typeof(IGraphicsDeviceService));
vertexDecl = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements());
verts = new VertexPositionTexture[]
{
new VertexPositionTexture(
new Vector3(0,0,0),
new Vector2(1,1)),
new VertexPositionTexture(
new Vector3(0,0,0),
new Vector2(0,1)),
new VertexPositionTexture(
new Vector3(0,0,0),
new Vector2(0,0)),
new VertexPositionTexture(
new Vector3(0,0,0),
new Vector2(1,0))
};
ib = new short[] { 0, 1, 2, 2, 3, 0 };
}
开发者ID:razvanalex,项目名称:XNAEnvironment,代码行数:28,代码来源:QuadRenderComponent.cs
示例15: InstancedModelDrawer
public InstancedModelDrawer(Game game)
: base(game)
{
#if WINDOWS
var resourceContentManager = new ResourceContentManager(game.Services, Indiefreaks.Xna.BEPU.Resources.WindowsPhysicsResources.ResourceManager);
#elif XBOX360
var resourceContentManager = new ResourceContentManager(game.Services, Indiefreaks.Xna.BEPU.Resources.Xbox360PhysicsResources.ResourceManager);
#else
ResourceContentManager resourceContentManager = null;
#endif
instancingEffect = resourceContentManager.Load<Effect>("InstancedEffect");
worldTransformsParameter = instancingEffect.Parameters["WorldTransforms"];
textureIndicesParameter = instancingEffect.Parameters["TextureIndices"];
viewParameter = instancingEffect.Parameters["View"];
projectionParameter = instancingEffect.Parameters["Projection"];
instancingEffect.Parameters["LightDirection1"].SetValue(Vector3.Normalize(new Vector3(.8f, -1.5f, -1.2f)));
instancingEffect.Parameters["DiffuseColor1"].SetValue(new Vector3(.66f, .66f, .66f));
instancingEffect.Parameters["LightDirection2"].SetValue(Vector3.Normalize(new Vector3(-.8f, 1.5f, 1.2f)));
instancingEffect.Parameters["DiffuseColor2"].SetValue(new Vector3(.3f, .3f, .5f));
instancingEffect.Parameters["AmbientAmount"].SetValue(.5f);
instancingEffect.Parameters["Texture0"].SetValue(textures[0]);
instancingEffect.Parameters["Texture1"].SetValue(textures[1]);
instancingEffect.Parameters["Texture2"].SetValue(textures[2]);
instancingEffect.Parameters["Texture3"].SetValue(textures[3]);
instancingEffect.Parameters["Texture4"].SetValue(textures[4]);
instancingEffect.Parameters["Texture5"].SetValue(textures[5]);
instancingEffect.Parameters["Texture6"].SetValue(textures[6]);
instancingEffect.Parameters["Texture7"].SetValue(textures[7]);
//This vertex declaration could be compressed or made more efficient, but such optimizations weren't critical.
instancingVertexDeclaration = new VertexDeclaration(new[] {new VertexElement(0, VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 1)});
}
开发者ID:VICOGameStudio-Ujen,项目名称:igf,代码行数:35,代码来源:InstancedModelDrawer.cs
示例16: Quad
public Quad( Vector3[] verts, Vector3 position, Texture2D texture )
{
if ( verts.Length != 4 )
throw new InvalidOperationException( "Quad must have four vertices." );
localPositions = verts;
vertices = new VertexPositionTexture[4];
Array.Copy( verts, localPositions, 4 );
vertices[0].TextureCoordinate = new Vector2( 0, 0 );
vertices[1].TextureCoordinate = new Vector2( 1, 0 );
vertices[2].TextureCoordinate = new Vector2( 1, 1 );
vertices[3].TextureCoordinate = new Vector2( 0, 1 );
Position = position;
Scale = 1f;
device = ZombieCraft.Instance.GraphicsDevice;
vertexDeclaraion = new VertexDeclaration( device, VertexPositionTexture.VertexElements );
effect = ZombieCraft.Instance.Content.Load<Effect>( "Effects/Primitive" ).Clone( device );
effect.CurrentTechnique = effect.Techniques["Texture"];
viewParam = effect.Parameters["View"];
projectionParam = effect.Parameters["Projection"];
textureParam = effect.Parameters["Texture"];
colorParam = effect.Parameters["Color"];
Texture = texture;
}
开发者ID:yxrkt,项目名称:outbreak,代码行数:26,代码来源:Quad.cs
示例17: Add
public static void Add(Type vertexType,VertexDeclaration dec)
{
if(!_declarations.Keys.Contains(vertexType))
{
_declarations.Add(vertexType, dec);
}
}
开发者ID:brookpatten,项目名称:VisualSail,代码行数:7,代码来源:VertexDeclarationHelper.cs
示例18: SetupVertices
private void SetupVertices() {
vertices = new VertexPositionColor[size.X * size.Y + 2];
vertexDeclaration = new VertexDeclaration(vertices);
vertexBuffer = new VertexBuffer(CamTest.graphics.GraphicsDevice, typeof(VertexPositionColor), vertices.Length, BufferUsage.None);
int vertID = 0;
for (int x = 0; x < size.X + 1; x++) {
vertices[vertID].Position = new Vector3(x * cellSize.X, 0f, 0f);
vertices[vertID].Color = color;
vertices[vertID + 1].Position = new Vector3(x * cellSize.X, 0f, size.Y * cellSize.Y);
vertices[vertID + 1].Color = color;
vertID += 2;
}
for (int y = 0; y < size.Y + 1; y++) {
vertices[vertID].Position = new Vector3(0f, 0f, y * cellSize.Y);
vertices[vertID].Color = color;
vertices[vertID + 1].Position = new Vector3(size.X * cellSize.X, 0f, y * cellSize.Y);
vertices[vertID + 1].Color = color;
vertID += 2;
}
vertexBuffer.SetData<VertexPositionColor>(vertices);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:25,代码来源:Grid.cs
示例19: RenderVertexPositionColorList
public static void RenderVertexPositionColorList(GraphicsDevice gd,
BasicEffect effect, Matrix world, Matrix view, Matrix proj,
VertexPositionColor[] vertices, VertexDeclaration vertexDeclaration,
VertexBuffer vertex_buffer)
{
// gd.VertexDeclaration = vertexDeclaration;
effect.World = world;
effect.View = view;
effect.Projection = proj;
effect.VertexColorEnabled = true;
if (vertex_buffer == null)
{
vertex_buffer = new VertexBuffer(gd, typeof(VertexPositionColor), vertices.Length, BufferUsage.WriteOnly);
vertex_buffer.SetData<VertexPositionColor>(vertices);
}
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
gd.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, vertices.Length / 3);
}
}
开发者ID:DigitalLibrarian,项目名称:xna-forever,代码行数:25,代码来源:Renderer.cs
示例20: LineBatch
public LineBatch(GraphicsDevice graphicsDevice)
{
// assign the graphics device parameter after safety-checking
if (graphicsDevice == null)
{
throw new ArgumentNullException("graphicsDevice");
}
this.graphicsDevice = graphicsDevice;
// create and configure the effect
this.effect = new BasicEffect(graphicsDevice);
this.effect.VertexColorEnabled = true;
this.effect.TextureEnabled = false;
this.effect.LightingEnabled = false;
// configure the effect
this.effect.World = Matrix.Identity;
this.effect.View = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward,
Vector3.Up);
// create the vertex declaration
//this.vertexDeclaration = new VertexDeclaration(graphicsDevice,
// VertexPositionColor.VertexElements);
this.vertexDeclaration = new VertexDeclaration(new VertexElement());
// create the vertex array
this.vertices = new VertexPositionColor[maxVertexCount];
}
开发者ID:JoeMarsh,项目名称:Astro-Flare-Rampage,代码行数:27,代码来源:LineBatch.cs
注:本文中的Microsoft.Xna.Framework.Graphics.VertexDeclaration类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论