本文整理汇总了C#中System.Buffer.GetView方法的典型用法代码示例。如果您正苦于以下问题:C# Buffer.GetView方法的具体用法?C# Buffer.GetView怎么用?C# Buffer.GetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Buffer
的用法示例。
在下文中一共展示了Buffer.GetView方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SegmentRenderer
public SegmentRenderer()
{
m_program = TriangleProgram.Instance;
m_instances = new List<SegmentInstance>();
m_vao = new VertexArray();
GL.BindVertexArray(m_vao);
GL.UseProgram(m_program);
m_bufferSprite = new Buffer<SegmentData>();
m_bufferTriangle = new Buffer<Vector3>();
m_program.Position.SetValue(m_bufferSprite.GetView<Vector3>("Position"));
m_program.Color.SetValue(m_bufferSprite.GetView<Color4ub>("Color"));
//m_program.Position.SetDivisor(1);
// m_program.Normal.SetValue(m_bufferSprite.GetView<Vector3>("Normal"));
//// m_program.Normal.SetDivisor(1);
// m_program.Transform.SetValue(m_bufferSprite.GetView<Matrix4>("Transform"));
// //m_program.Transform.SetDivisor(1);
// m_program.TextureOrigin.SetValue(m_bufferSprite.GetView<Vector2>("TextureOrigin"));
// //m_program.TextureOrigin.SetDivisor(1);
// m_program.TextureTarget.SetValue(m_bufferSprite.GetView<Vector2>("TextureTarget"));
//m_program.TextureTarget.SetDivisor(1);
GL.BindVertexArray(null);
m_isDirty = true;
}
示例2: SpriteRenderer
public SpriteRenderer(SpriteSheet spriteSheet)
{
SpriteSheet = spriteSheet;
m_program = SpriteProgram.Instance;
m_instances = new List<SpriteInstance>();
m_vao = new VertexArray();
GL.BindVertexArray(m_vao);
m_bufferSprite = new Buffer<SpriteData>();
m_bufferQuad = new Buffer<Vector3>();
m_bufferQuad.SetData(new Vector3[] {
new Vector3(0f, 0f, 0f),
new Vector3(0f, 1f, 0f),
new Vector3(1f, 1f, 0f),
new Vector3(1f, 0f, 0f)
});
GL.UseProgram(m_program);
m_program.Position.SetValue(m_bufferQuad.GetView());
m_program.Transform.SetValue(m_bufferSprite.GetView<Matrix4>("Transform"));
m_program.Transform.SetDivisor(1);
m_program.TextureOrigin.SetValue(m_bufferSprite.GetView<Vector2>("TextureOrigin"));
m_program.TextureOrigin.SetDivisor(1);
m_program.TextureTarget.SetValue(m_bufferSprite.GetView<Vector2>("TextureTarget"));
m_program.TextureTarget.SetDivisor(1);
GL.BindVertexArray(null);
m_isDirty = true;
}
示例3: Graphics
public Graphics(int queueCapacity = 1000)
{
m_queueCapacity = queueCapacity;
m_queue = new QuadData[m_queueCapacity];
m_textureQueue = new Texture2D[TEXTURE_QUEUE_CAPACITY];
m_transformStack = new Stack<Matrix3x2>();
m_verticesBuffer = new Buffer<Vector2>();
m_verticesBuffer.SetData(new Vector2[] {
new Vector2(0,0),
new Vector2(0,1),
new Vector2(1,1),
new Vector2(1,0)
});
m_quadsBuffer = new Buffer<QuadData>();
m_quadsBuffer.SetData(m_queueCapacity, GL.STREAM_DRAW);
m_program = QuadProgram.Instance;
m_vertexArray = new VertexArray();
GL.UseProgram(m_program);
GL.BindVertexArray(m_vertexArray);
m_program.Vertex.SetValue(m_verticesBuffer.GetView());
m_program.TextureCoordinates0.SetValue(m_quadsBuffer.GetView<Vector2>("TextureCoordinates0"));
m_program.TextureCoordinates0.SetDivisor(1);
m_program.TextureCoordinates1.SetValue(m_quadsBuffer.GetView<Vector2>("TextureCoordinates1"));
m_program.TextureCoordinates1.SetDivisor(1);
m_program.Transform.SetValue(m_quadsBuffer.GetView<Matrix3x2>("Transform"));
m_program.Transform.SetDivisor(1);
m_program.Color.SetValue(m_quadsBuffer.GetView<Color4ub>("Color"));
m_program.Color.SetDivisor(1);
m_program.Texture.SetValue(m_quadsBuffer.GetView<int>("Texture"));
m_program.Texture.SetDivisor(1);
GL.BindVertexArray(null);
Clear();
}
示例4: Renderer
public Renderer(TriangleProgram program)
{
m_program = program;
m_datas = new List<RendererData>();
m_vao = new VertexArray();
GL.BindVertexArray(m_vao);
m_buffer = new Buffer<RendererData>();
GL.UseProgram(m_program);
m_program.Position.SetValue(m_buffer.GetView(s => s.Position));
m_program.Color.SetValue(m_buffer.GetView(s => s.Color));
m_program.TextureCoordinates.SetValue(m_buffer.GetView(s => s.TextureCoordinates));
GL.BindVertexArray(null);
}
示例5: SpriteRenderer
public SpriteRenderer(SpriteSheet spriteSheet)
{
SpriteSheet = spriteSheet;
textureFire = Texture2D.Load(typeof(Particle).Assembly.GetManifestResourceStream("Granite.Particle.Textures.fire_color.png"));
m_program = SpriteProgram.Instance;
m_instances = new List<SpriteInstance>();
m_vao = new VertexArray();
GL.BindVertexArray(m_vao);
m_bufferSprite = new Buffer<SpriteData>();
m_bufferQuad = new Buffer<Vector3>();
m_bufferQuad.SetData(new Vector3[] {
new Vector3(0f, 0f, 0f),
new Vector3(0f, 1f, 0f),
new Vector3(1f, 1f, 0f),
new Vector3(1f, 0f, 0f)
});
GL.UseProgram(m_program);
m_program.Position.SetValue(m_bufferQuad.GetView());
//m_program.Color.SetValue(m_bufferSprite.GetView(s => s.Color));
//m_program.Color.SetDivisor(1);
m_program.Transform.SetValue(m_bufferSprite.GetView<Matrix4>("Transform"));
m_program.Transform.SetDivisor(1);
m_program.TextureOrigin.SetValue(m_bufferSprite.GetView<Vector2>("TextureOrigin"));
m_program.TextureOrigin.SetDivisor(1);
m_program.TextureTarget.SetValue(m_bufferSprite.GetView<Vector2>("TextureTarget"));
m_program.TextureTarget.SetDivisor(1);
m_program.Progress.SetValue(m_bufferSprite.GetView(s => s.Progress));
m_program.Progress.SetDivisor(1);
GL.BindVertexArray(null);
m_isDirty = true;
}