本文整理汇总了C#中DrawMode类的典型用法代码示例。如果您正苦于以下问题:C# DrawMode类的具体用法?C# DrawMode怎么用?C# DrawMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrawMode类属于命名空间,在下文中一共展示了DrawMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ZeroIndexBuffer
/// <summary>
/// Wraps glDrawArrays(uint mode, int first, int count).
/// </summary>
/// <param name="mode">用哪种方式渲染各个顶点?(OpenGL.GL_TRIANGLES etc.)</param>
/// <param name="firstVertex">要渲染的第一个顶点的位置。<para>Index of first vertex to be rendered.</para></param>
/// <param name="vertexCount">要渲染多少个元素?<para>How many vertexes to be rendered?</para></param>
/// <param name="primCount">primCount in instanced rendering.</param>
internal ZeroIndexBuffer(DrawMode mode, int firstVertex, int vertexCount, int primCount = 1)
: base(mode, 0, vertexCount, vertexCount * sizeof(uint), primCount)
{
this.FirstVertex = firstVertex;
this.RenderingVertexCount = vertexCount;
//this.OriginalVertexCount = vertexCount;
}
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:14,代码来源:ZeroIndexBuffer.cs
示例2: GetLineSearcher
private static OneIndexLineSearcher GetLineSearcher(DrawMode mode)
{
if (lineSearcherDict == null)
{
var triangle = new OneIndexLineInTriangleSearcher();
var quad = new OneIndexLineInQuadSearcher();
var polygon = new OneIndexLineInPolygonSearcher();
var dict = new Dictionary<DrawMode, OneIndexLineSearcher>();
dict.Add(DrawMode.Triangles, triangle);
dict.Add(DrawMode.TrianglesAdjacency, triangle);
dict.Add(DrawMode.TriangleStrip, triangle);
dict.Add(DrawMode.TriangleStripAdjacency, triangle);
dict.Add(DrawMode.TriangleFan, triangle);
dict.Add(DrawMode.Quads, quad);
dict.Add(DrawMode.QuadStrip, quad);
dict.Add(DrawMode.Polygon, polygon);
lineSearcherDict = dict;
}
OneIndexLineSearcher result = null;
if (lineSearcherDict.TryGetValue(mode, out result))
{ return result; }
else
{ return null; }
}
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:26,代码来源:OneIndexRenderer.GetSearcher.cs
示例3: AnimSprite
float viewOffset; // view offset moves sprite in direction of camera
#endregion Fields
#region Constructors
/// <summary>
/// Create a new animated sprite
/// </summary>
public AnimSprite(
AnimSpriteType type,
Vector3 position, float radius, float viewOffset,
Texture2D texture, int frameSizeX, int frameSizeY,
float frameRate, DrawMode mode, int player)
{
if (texture == null)
{
throw new ArgumentNullException("texture");
}
spriteType = type;
this.position = position;
this.radius = radius;
this.viewOffset = viewOffset;
this.texture = texture;
this.player = player;
this.frameRate = frameRate;
this.drawMode = mode;
// frame size
float sizeX = (float)frameSizeX / (float)texture.Width;
float sizeY = (float)frameSizeY / (float)texture.Height;
frameSize = new Vector2(sizeX, sizeY);
// number of frames
numberFramesX = texture.Width / frameSizeX;
numberFramesY = texture.Height / frameSizeY;
numberFrames = numberFramesX * numberFramesY;
// total animation time
totalTime = (float)numberFrames / frameRate;
elapsedTime = 0;
}
开发者ID:CS583,项目名称:The3dgamesample,代码行数:43,代码来源:AnimSprite.cs
示例4: BackgroundComponent
public BackgroundComponent(Game game, Texture2D image, DrawMode drawMode)
{
Visible = true;
this.image = image;
this.drawMode = drawMode;
screenRectangle = new Rectangle(
0,
0,
game.Window.ClientBounds.Width,
game.Window.ClientBounds.Height);
//Nastaveni Rectanglu pro vykresleni bud na cely obraz nebo jen podle velikosti textury
switch (drawMode)
{
case DrawMode.Center:
destination = new Rectangle(
(screenRectangle.Width - image.Width) / 2,
(screenRectangle.Height - image.Height) / 2,
image.Width,
image.Height);
break;
case DrawMode.Fill:
destination = new Rectangle(
screenRectangle.X,
screenRectangle.Y,
screenRectangle.Width,
screenRectangle.Height);
break;
}
}
开发者ID:jakubsuchybio,项目名称:App-RPG-HoMaM-II-copy,代码行数:30,代码来源:BackGroundComponent.cs
示例5: GraphicManager
protected int timerPerion; // частота отрисовки графиков в активном режиме
#endregion Fields
#region Constructors
/// <summary>
/// Инициализирует новый экземпляр класса
/// </summary>
/// <param name="GPanel">Панель которую будет обслуживать манеджер</param>
public GraphicManager(Panel GPanel)
{
mutex = new Mutex();
slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
mode = DrawMode.Default;
if (GPanel != null)
{
panel = GPanel;
//panel.StartTime = DateTime.Now;
panel.OnResize += new EventHandler(Sheet_Resize);
panel.Sheet.onOrientationChange += new EventHandler(Sheet_onOrientationChange);
panel.Sheet.onIntervalInCellChange += new EventHandler(Sheet_onIntervalInCellChange);
timerPerion = 500;
timer = new Timer(TimerCallback, null, Timeout.Infinite, timerPerion);
}
else
{
throw new ArgumentNullException();
}
}
开发者ID:slawer,项目名称:skc,代码行数:35,代码来源:GraphicManager.cs
示例6: ZeroAttributeModel
/// <summary>
/// Bufferable model with zero vertex attribute.
/// </summary>
/// <param name="mode">渲染模式。</param>
/// <param name="firstVertex">要渲染的第一个顶点的位置。<para>Index of first vertex to be rendered.</para></param>
/// <param name="vertexCount">要渲染多少个元素?<para>How many vertexes to be rendered?</para></param>
/// <param name="primCount">primCount in instanced rendering.</param>
public ZeroAttributeModel(DrawMode mode, int firstVertex, int vertexCount, int primCount = 1)
{
this.Mode = mode;
this.FirstVertex = firstVertex;
this.VertexCount = vertexCount;
this.PrimCount = primCount;
}
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:14,代码来源:ZeroAttributeModel.cs
示例7: SetHighlightIndexes
/// <summary>
/// 设置要高亮显示的图元。
/// </summary>
/// <param name="mode">要高亮显示的图元类型</param>
/// <param name="indexes">要高亮显示的图元的索引。</param>
public void SetHighlightIndexes(DrawMode mode, params uint[] indexes)
{
int indexesLength = indexes.Length;
if (indexesLength > this.maxElementCount)
{
IndexBuffer original = this.indexBuffer;
this.indexBuffer = Buffer.Create(IndexBufferElementType.UInt, indexesLength, mode, BufferUsage.StaticDraw);
this.maxElementCount = indexesLength;
original.Dispose();
}
var indexBuffer = this.indexBuffer as OneIndexBuffer;
IntPtr pointer = indexBuffer.MapBuffer(MapBufferAccess.WriteOnly);
unsafe
{
var array = (uint*)pointer.ToPointer();
for (int i = 0; i < indexesLength; i++)
{
array[i] = indexes[i];
}
}
indexBuffer.UnmapBuffer();
indexBuffer.Mode = mode;
indexBuffer.ElementCount = indexesLength;
}
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:31,代码来源:HighlightRenderer.SetupHighlight.cs
示例8: PictureBox3D
public PictureBox3D(DeviceManager initDM, SceneManager initSM)
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// initialize members
nameVisible = true; // show the name of this viewport on-screen?
_drawMode = DrawMode.wireFrame; // default to wireframe view
arcBall = new ArcBall(this);
arcBall.Radius = 1.0f;
BuildCameraMenu();
// new events
Midget.Events.EventFactory.DeselectObjects +=new Midget.Events.Object.Selection.DeselectObjectEventHandler(EventFactory_DeselectObjects);
Midget.Events.EventFactory.SelectAdditionalObject +=new Midget.Events.Object.Selection.SelectAdditionalObjectEventHandler(EventFactory_SelectAdditionalObject);
Midget.Events.EventFactory.AdjustCameraEvent +=new Midget.Events.User.AdjustCameraEventHandler(EventFactory_AdjustCameraEvent);
Midget.Events.EventFactory.SwitchEditModeEvent +=new Midget.Events.User.SwitchEditModeEventHandler(EventFactory_SwitchEditModeEvent);
selectedObjects = new ArrayList();
this.dm = initDM;
// attach listener for render event
dm.Render += new System.EventHandler(this.Viewport_Render);
this.renderView += new RenderSingleViewHandler(dm.OnRenderSingleView);
this.sm = initSM;
this.ConfigureRenderTarget();
}
开发者ID:deobald,项目名称:midget,代码行数:30,代码来源:PictureBox3D.cs
示例9: Draw
public void Draw(DrawMode Mode,VertexBuffer VB)
{
if(VB == null)
throw new Exception("Must have Vertex Buffer");
if(VB.Normal != null)
{
gl.EnableClientState(NORMAL_ARRAY);
gl.BindBuffer((uint)VB.Normal.BType,VB.Normal.B);
gl.NormalPointer((uint)VB.Normal.T,0,null);
}
else gl.DisableClientState(NORMAL_ARRAY);
if(VB.TexCoord != null)
{
gl.EnableClientState(TEXTURE_COORD_ARRAY);
gl.BindBuffer((uint)VB.TexCoord.BType,VB.TexCoord.B);
gl.TexCoordPointer(VB.TexCoord.Size,(uint)VB.TexCoord.T,0,null);
}
else gl.DisableClientState(TEXTURE_COORD_ARRAY);
gl.EnableClientState(VERTEX_ARRAY);
gl.BindBuffer((uint)VB.BType,VB.B);
gl.VertexPointer(VB.Size,(uint)VB.T,0,null);
gl.DrawArrays((uint)Mode,0,VB.Count);
gl.DisableClientState(VERTEX_ARRAY);
gl.DisableClientState(NORMAL_ARRAY);
gl.DisableClientState(TEXTURE_COORD_ARRAY);
}
开发者ID:miquik,项目名称:leviatan-game,代码行数:34,代码来源:Buffer.cs
示例10: ArrangeIndexes
/// <summary>
/// 将共享点前移,构成2个图元组成的新的小小的索引。
/// </summary>
/// <param name="recognizedPrimitiveIndex0"></param>
/// <param name="recognizedPrimitiveIndex1"></param>
/// <param name="drawMode"></param>
/// <param name="lastIndex0"></param>
/// <param name="lastIndex1"></param>
/// <returns></returns>
private List<uint> ArrangeIndexes(
RecognizedPrimitiveInfo recognizedPrimitiveIndex0,
RecognizedPrimitiveInfo recognizedPrimitiveIndex1,
DrawMode drawMode,
out uint lastIndex0, out uint lastIndex1)
{
var sameIndexList = new List<uint>();
var array0 = new List<uint>(recognizedPrimitiveIndex0.VertexIds);
var array1 = new List<uint>(recognizedPrimitiveIndex1.VertexIds);
array0.Sort(); array1.Sort();
int p0 = 0, p1 = 0;
while (p0 < array0.Count && p1 < array1.Count)
{
if (array0[p0] < array1[p1])
{ p0++; }
else if (array0[p0] > array1[p1])
{ p1++; }
else
{
sameIndexList.Add(array0[p0]);
array0.RemoveAt(p0);
array1.RemoveAt(p1);
}
}
if (array0.Count == 0 && array1.Count == 0)
{ throw new Exception("Two primitives are totally the same!"); }
if (array0.Count > 0)
{ lastIndex0 = array0.Last(); }
else
{
if (sameIndexList.Count == 0)
{ throw new Exception("array0 is totally empty!"); }
lastIndex0 = sameIndexList.Last();
}
if (array1.Count > 0)
{ lastIndex1 = array1.Last(); }
else
{
if (sameIndexList.Count == 0)
{ throw new Exception("array1 is totally empty!"); }
lastIndex1 = sameIndexList.Last();
}
if (lastIndex0 == lastIndex1) { throw new Exception(); }
var result = new List<uint>();
result.AddRange(sameIndexList);
result.AddRange(array0);
result.Add(uint.MaxValue);// primitive restart index
result.AddRange(sameIndexList);
result.AddRange(array1);
return result;
}
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:68,代码来源:OneIndexRenderer.GetLastIndexId.cs
示例11: DrawArgs
/// <summary>
/// Initializes a new instance of <see cref="DrawArgs"/>.
/// </summary>
public DrawArgs(
IRenderingSurface surface,
Screen screen,
DrawMode drawMode)
{
_renderingSurface = surface;
_screen = screen;
_drawMode = drawMode;
}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:12,代码来源:DrawArgs.cs
示例12: Create
public static PrimitiveRecognizer Create(DrawMode mode)
{
PrimitiveRecognizer recognizer = null;
switch (mode)
{
case DrawMode.Points:
recognizer = new PointsRecognizer();
break;
case DrawMode.LineStrip:
recognizer = new LineStripRecognizer();
break;
case DrawMode.LineLoop:
recognizer = new LineLoopRecognizer();
break;
case DrawMode.Lines:
recognizer = new LinesRecognizer();
break;
case DrawMode.LineStripAdjacency:
break;
case DrawMode.LinesAdjacency:
break;
case DrawMode.TriangleStrip:
recognizer = new TriangleStripRecognizer();
break;
case DrawMode.TriangleFan:
recognizer = new TriangleFanRecognizer();
break;
case DrawMode.Triangles:
recognizer = new TrianglesRecognizer();
break;
case DrawMode.TriangleStripAdjacency:
break;
case DrawMode.TrianglesAdjacency:
break;
case DrawMode.Patches:
break;
case DrawMode.QuadStrip:
recognizer = new QuadStripRecognizer();
break;
case DrawMode.Quads:
recognizer = new QuadsRecognizer();
break;
case DrawMode.Polygon:
break;
default:
break;
}
if (recognizer == null)
{
throw new NotImplementedException(string.Format(
"尚未实现[{0}]的recognizer!", mode));
}
return recognizer;
}
开发者ID:chantsunman,项目名称:CSharpGL,代码行数:57,代码来源:PrimitiveRecognizerFactory.cs
示例13: GenericMaterial
public GenericMaterial(Texture tex, Texture normalMap = null, Texture bumpMap = null)
{
CompileShaders();
Tex = tex;
NormalMap = normalMap;
bumpMap = bumpMap;
Color = Vector4.One;
Mode = GenericMaterial.DrawMode.TextureOnly;
}
开发者ID:yanko,项目名称:vengine,代码行数:9,代码来源:GenericMaterial.cs
示例14: Mesh
/// <summary>
/// 创建一个mesh对象,不使用索引缓冲
/// </summary>
/// <param name="pt"></param>
/// <param name="vb"></param>
/// <param name="vd"></param>
public Mesh(PrimitiveType pt, VertexBuffer vb, VertexDeclaration vd)
{
this.is_visible = true;
this.vertices_count = vb.SizeInBytes / vd.GetVertexStrideSize(0);
this.draw_mode = DrawMode.Primitive;
this.primitive_type = pt;
this.vb = vb;
this.vd = vd;
this.primitive_count = CalcPrimitiveCount();
}
开发者ID:konlil,项目名称:pipe,代码行数:16,代码来源:Mesh.cs
示例15: Context
public Context(int width, int height)
{
Width = width;
Height = height;
_Context = new GraphicsContext(width,height, PixelFormat.Rgba, PixelFormat.Depth24,MultiSampleMode.Msaa4x);
AspectRatio = _Context.Screen.AspectRatio;
drawMode = DrawMode.Triangles;
}
开发者ID:himanshugoel2797,项目名称:Aperture3D-PSM,代码行数:10,代码来源:Context.cs
示例16: MeshData
public MeshData( DrawMode mode, int vertexCount, int indexCount )
{
drawMode = mode;
positions = new float[ vertexCount * 3 ];
normals = new float[ vertexCount * 3 ];
tangents = new float[ vertexCount * 3 ];
colors = new float[ vertexCount * 4 ];
texcoords = new float[ vertexCount * 2 ];
indices = new ushort[ indexCount ];
}
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:10,代码来源:MeshData.cs
示例17: InitVAO
private void InitVAO()
{
this.axisPrimitiveMode = DrawMode.LineLoop;
this.axisVertexCount = 4;
this.vao = new uint[1];
GL.GenVertexArrays(1, vao);
GL.BindVertexArray(vao[0]);
// Create a vertex buffer for the vertex data.
{
UnmanagedArray<vec3> positionArray = new UnmanagedArray<vec3>(4);
positionArray[0] = new vec3(-0.5f, -0.5f, 0);
positionArray[1] = new vec3(0.5f, -0.5f, 0);
positionArray[2] = new vec3(0.5f, 0.5f, 0);
positionArray[3] = new vec3(-0.5f, 0.5f, 0);
uint positionLocation = shaderProgram.GetAttributeLocation(strin_Position);
uint[] ids = new uint[1];
GL.GenBuffers(1, ids);
GL.BindBuffer(BufferTarget.ArrayBuffer, ids[0]);
GL.BufferData(BufferTarget.ArrayBuffer, positionArray, BufferUsage.StaticDraw);
GL.VertexAttribPointer(positionLocation, 3, GL.GL_FLOAT, false, 0, IntPtr.Zero);
GL.EnableVertexAttribArray(positionLocation);
positionArray.Dispose();
}
// Now do the same for the colour data.
{
UnmanagedArray<vec3> colorArray = new UnmanagedArray<vec3>(4);
vec3 color = this.rectColor;
for (int i = 0; i < colorArray.Length; i++)
{
colorArray[i] = color;
}
uint colorLocation = shaderProgram.GetAttributeLocation(strin_Color);
uint[] ids = new uint[1];
GL.GenBuffers(1, ids);
GL.BindBuffer(BufferTarget.ArrayBuffer, ids[0]);
GL.BufferData(BufferTarget.ArrayBuffer, colorArray, BufferUsage.StaticDraw);
GL.VertexAttribPointer(colorLocation, 3, GL.GL_FLOAT, false, 0, IntPtr.Zero);
GL.EnableVertexAttribArray(colorLocation);
colorArray.Dispose();
}
// Unbind the vertex array, we've finished specifying data for it.
GL.BindVertexArray(0);
}
开发者ID:xinfushe,项目名称:CSharpGL,代码行数:54,代码来源:SimpleUIRect.cs
示例18: GraphicsDevice
public GraphicsDevice(SDLWindow window)
{
this.window = window;
screen = window.Screen;
BeginDraw();
FillScreen(0, 0, 0, 255);
EndDraw();
LoadTextures();
currentDrawMode = DrawMode.Unknown;
}
开发者ID:sinshu,项目名称:chaos,代码行数:12,代码来源:GraphicsDevice.cs
示例19: InitVAO
private void InitVAO()
{
this.mode = DrawMode.Quads;
this.vertexCount = 4;
// Create a vertex buffer for the vertex data.
UnmanagedArray<vec3> in_Position = new UnmanagedArray<vec3>(this.vertexCount);
UnmanagedArray<vec2> in_TexCoord = new UnmanagedArray<vec2>(this.vertexCount);
Bitmap bigBitmap = this.ttfTexture.BigBitmap;
float factor = (float)this.ttfTexture.BigBitmap.Width / (float)this.ttfTexture.BigBitmap.Height;
float x1 = -factor;
float x2 = factor;
float y1 = -1;
float y2 = 1;
in_Position[0] = new vec3(x1, y1, 0);
in_Position[1] = new vec3(x2, y1, 0);
in_Position[2] = new vec3(x2, y2, 0);
in_Position[3] = new vec3(x1, y2, 0);
in_TexCoord[0] = new vec2(0, 0);
in_TexCoord[1] = new vec2(1, 0);
in_TexCoord[2] = new vec2(1, 1);
in_TexCoord[3] = new vec2(0, 1);
if (vao[0] != 0)
{ GL.DeleteBuffers(1, vao); }
if (vbo[0] != 0)
{ GL.DeleteBuffers(vbo.Length, vbo); }
GL.GenVertexArrays(1, vao);
GL.BindVertexArray(vao[0]);
GL.GenBuffers(2, vbo);
uint in_PositionLocation = shaderProgram.GetAttributeLocation(strin_Position);
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[0]);
GL.BufferData(BufferTarget.ArrayBuffer, in_Position, BufferUsage.StaticDraw);
GL.VertexAttribPointer(in_PositionLocation, 3, GL.GL_FLOAT, false, 0, IntPtr.Zero);
GL.EnableVertexAttribArray(in_PositionLocation);
uint in_TexCoordLocation = shaderProgram.GetAttributeLocation(strin_TexCoord);
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[1]);
GL.BufferData(BufferTarget.ArrayBuffer, in_TexCoord, BufferUsage.StaticDraw);
GL.VertexAttribPointer(in_TexCoordLocation, 2, GL.GL_FLOAT, false, 0, IntPtr.Zero);
GL.EnableVertexAttribArray(in_TexCoordLocation);
GL.BindVertexArray(0);
in_Position.Dispose();
in_TexCoord.Dispose();
}
开发者ID:xinfushe,项目名称:CSharpGL,代码行数:53,代码来源:WholeFontTextureElement.cs
示例20: Draw
void Draw( Player player, Command command, DrawMode mode ) {
if( !player.Can( Permissions.Draw ) ) {
world.NoAccessMessage( player );
return;
}
if( player.drawingInProgress ) {
player.Message( "Another draw command is already in progress. Please wait." );
return;
}
string blockName = command.Next();
Block block;
if( blockName == null || blockName == "" ) {
if( mode == DrawMode.Cuboid ) {
player.Message( "Usage: " + Color.Help + "/cuboid blockName" + Color.Sys + " or " + Color.Help + "/cub blockName" );
} else {
player.Message( "Usage: " + Color.Help + "/ellipsoid blockName" + Color.Sys + " or " + Color.Help + "/ell blockName" );
}
return;
}
try {
block = Map.GetBlockByName( blockName );
} catch( Exception ) {
player.Message( "Unknown block name: " + blockName );
return;
}
player.tag = block;
Permissions permission = Permissions.Build;
switch( block ) {
case Block.Admincrete: permission = Permissions.PlaceAdmincrete; break;
case Block.Air: permission = Permissions.Delete; break;
case Block.Water:
case Block.StillWater: permission = Permissions.PlaceWater; break;
case Block.Lava:
case Block.StillLava: permission = Permissions.PlaceLava; break;
}
if( !player.Can( permission ) ) {
player.Message( "You are not allowed to draw with this block." );
return;
}
player.marksExpected = 2;
player.markCount = 0;
player.marks.Clear();
player.Message( mode.ToString() + ": Place a block or type /mark to use your location." );
if( mode == DrawMode.Cuboid ) {
player.selectionCallback = DrawCuboid;
} else {
player.selectionCallback = DrawEllipsoid;
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:52,代码来源:DrawCommands.cs
注:本文中的DrawMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论