本文整理汇总了C#中PrimitiveType类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveType类的具体用法?C# PrimitiveType怎么用?C# PrimitiveType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveType类属于命名空间,在下文中一共展示了PrimitiveType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Mesh
public Mesh(int vbo, int ibo, int count, PrimitiveType mode)
{
VboId = vbo;
IboId = ibo;
Count = count;
Mode = mode;
}
开发者ID:ryanreigstad,项目名称:engine,代码行数:7,代码来源:Mesh.cs
示例2: VertexBufferObject
/// <summary>
/// Initializes a new <see cref="VertexBufferObject"/>
/// </summary>
/// <param name="vertexBufferLength">The lenght of the vertex buffer</param>
/// <param name="elementBufferLength">The lenght of the element buffer</param>
/// <param name="primitiveType">The <see cref="OpenTK.Graphics.OpenGL.PrimitiveType"/> used to render the <see cref="VertexBufferObject"/></param>
public VertexBufferObject(int vertexBufferLength, int elementBufferLength, PrimitiveType primitiveType)
{
this.VertexBufferLength = vertexBufferLength;
this.ElementBufferLength = elementBufferLength;
this.PrimitiveType = primitiveType;
this.Initialize();
}
开发者ID:yonglehou,项目名称:Photon,代码行数:13,代码来源:VertexBufferObject.cs
示例3: AddVertex
public void AddVertex( Vector2 vertex, Color color, PrimitiveType primitiveType )
{
if ( !_hasBegun )
throw new InvalidOperationException( "Begin must be called before AddVertex can be called." );
if ( primitiveType == PrimitiveType.LineStrip || primitiveType == PrimitiveType.TriangleStrip )
throw new NotSupportedException( "The specified primitiveType is not supported by PrimitiveBatch." );
if ( primitiveType == PrimitiveType.TriangleList ) {
if ( _triangleVertsCount >= _triangleVertices.Length )
FlushTriangles();
_triangleVertices[ _triangleVertsCount ].Position = new Vector3( vertex, -0.1f );
_triangleVertices[ _triangleVertsCount ].Color = color;
_triangleVertsCount++;
}
if ( primitiveType == PrimitiveType.LineList ) {
if ( _lineVertsCount >= _lineVertices.Length )
FlushLines();
_lineVertices[ _lineVertsCount ].Position = new Vector3( vertex, 0f );
_lineVertices[ _lineVertsCount ].Color = color;
_lineVertsCount++;
}
}
开发者ID:headdetect,项目名称:Flux-XNA,代码行数:26,代码来源:PrimitiveBatch.cs
示例4: Draw
public void Draw(IndexBuffer ibo, PrimitiveType primitiveType)
{
ibo.Draw();
bool bWireframe = (SceneManager.Current.RenderMode == SceneManager.RenderMeshMode.Wireframe);
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.NormalArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);
if (!bWireframe) { GL.EnableClientState(ArrayCap.ColorArray); }
GL.VertexPointer(3, VertexPointerType.Float, Vertex.Stride, new IntPtr(0));
GL.NormalPointer(NormalPointerType.Float, Vertex.Stride, new IntPtr(Vector3.SizeInBytes));
GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.Stride, new IntPtr(2 * Vector3.SizeInBytes));
if (!bWireframe) { GL.ColorPointer(4, ColorPointerType.Float, Vertex.Stride, new IntPtr((2 * Vector3.SizeInBytes) + Vector4.SizeInBytes)); }
GL.DrawElements(primitiveType, ibo.Length, DrawElementsType.UnsignedInt, IntPtr.Zero);
GL.DisableClientState(ArrayCap.VertexArray);
GL.DisableClientState(ArrayCap.NormalArray);
GL.DisableClientState(ArrayCap.TextureCoordArray);
if (!bWireframe) { GL.DisableClientState(ArrayCap.ColorArray);}
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
}
开发者ID:DevilboxGames,项目名称:Flummery,代码行数:27,代码来源:VertexBuffer.cs
示例5: CreateConstant
public Constant CreateConstant(ImmediateOperand imm, PrimitiveType dataWidth)
{
if (dataWidth.BitSize > imm.Width.BitSize)
return Constant.Create(dataWidth, imm.Value.ToInt64());
else
return Constant.Create(imm.Width, imm.Value.ToUInt32());
}
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:OperandRewriter.cs
示例6: InsertBinaryOperationMethod
private static void InsertBinaryOperationMethod(Core core, CodeBlockNode root, Operator op, PrimitiveType r, PrimitiveType op1, PrimitiveType op2, int retRank = 0, int op1rank = 0, int op2rank = 0)
{
FunctionDefinitionNode funcDefNode = new FunctionDefinitionNode();
funcDefNode.access = CompilerDefinitions.AccessModifier.kPublic;
funcDefNode.IsAssocOperator = true;
funcDefNode.IsBuiltIn = true;
funcDefNode.Name = Op.GetOpFunction(op);
funcDefNode.ReturnType = new Type() { Name = core.TypeSystem.GetType((int)r), UID = (int)r, rank = retRank };
ArgumentSignatureNode args = new ArgumentSignatureNode();
args.AddArgument(new VarDeclNode()
{
Access = CompilerDefinitions.AccessModifier.kPublic,
NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kLHS),
ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op1), UID = (int)op1, rank = op1rank }
});
args.AddArgument(new VarDeclNode()
{
Access = CompilerDefinitions.AccessModifier.kPublic,
NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kRHS),
ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op2), UID = (int)op2, rank = op2rank }
});
funcDefNode.Signature = args;
CodeBlockNode body = new CodeBlockNode();
var lhs = AstFactory.BuildIdentifier(DSASM.Constants.kLHS);
var rhs = AstFactory.BuildIdentifier(DSASM.Constants.kRHS);
var binaryExpr = AstFactory.BuildBinaryExpression(lhs, rhs, op);
body.Body.Add(AstFactory.BuildReturnStatement(binaryExpr));
funcDefNode.FunctionBody = body;
root.Body.Add(funcDefNode);
}
开发者ID:nmeek,项目名称:Dynamo,代码行数:33,代码来源:CoreUtils.cs
示例7: ConvertPrimitiveType
public static PrimitiveTopology ConvertPrimitiveType(PrimitiveType primitiveType)
{
switch (primitiveType)
{
case PrimitiveType.PointList:
return PrimitiveTopology.PointList;
case PrimitiveType.LineList:
return PrimitiveTopology.LineList;
case PrimitiveType.LineStrip:
return PrimitiveTopology.LineStrip;
case PrimitiveType.TriangleList:
return PrimitiveTopology.TriangleList;
case PrimitiveType.TriangleStrip:
return PrimitiveTopology.TriangleStrip;
case PrimitiveType.LineListWithAdjacency:
return PrimitiveTopology.LineListWithAdjacency;
case PrimitiveType.LineStripWithAdjacency:
return PrimitiveTopology.LineStripWithAdjacency;
case PrimitiveType.TriangleListWithAdjacency:
return PrimitiveTopology.TriangleListWithAdjacency;
case PrimitiveType.TriangleStripWithAdjacency:
return PrimitiveTopology.TriangleStripWithAdjacency;
default:
throw new ArgumentOutOfRangeException(nameof(primitiveType));
}
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:26,代码来源:VulkanConvertExtensions.cs
示例8: RewriteAcbi
private void RewriteAcbi(PrimitiveType width)
{
var limit = RewriteSrcOp(0, width);
var add = RewriteSrcOp(1, width);
var index = RewriteDstOp(2, width, e => emitter.IAdd(e, add));
NZV(index);
var cAdd = add as Constant;
if (cAdd == null)
throw new AddressCorrelatedException(
dasm.Current.Address,
"Instruction {0] too complex to rewrite.",
dasm.Current);
if (cAdd.ToInt32() >= 0)
{
emitter.Branch(
emitter.Le(index, limit),
((AddressOperand)dasm.Current.Operands[3]).Address,
RtlClass.ConditionalTransfer);
}
else
{
emitter.Branch(
emitter.Ge(index, limit),
((AddressOperand)dasm.Current.Operands[3]).Address,
RtlClass.ConditionalTransfer);
}
rtlc.Class = RtlClass.ConditionalTransfer;
}
开发者ID:relaxar,项目名称:reko,代码行数:29,代码来源:VaxRewriter.Control.cs
示例9: DrawMeshArraysSUN
public static void DrawMeshArraysSUN(PrimitiveType mode, Int32 first, Int32 count, Int32 width)
{
Debug.Assert(Delegates.pglDrawMeshArraysSUN != null, "pglDrawMeshArraysSUN not implemented");
Delegates.pglDrawMeshArraysSUN((Int32)mode, first, count, width);
LogFunction("glDrawMeshArraysSUN({0}, {1}, {2}, {3})", mode, first, count, width);
DebugCheckErrors(null);
}
开发者ID:rhynodegreat,项目名称:OpenGL.Net,代码行数:7,代码来源:Gl.SUN_mesh_array.cs
示例10: Draw
public void Draw(PrimitiveType mode, IElementArray elements)
{
using (elements.Bind())
{
_gl.DrawElements(mode, (int)elements.Elements, (uint)elements.Type, IntPtr.Zero);
}
}
开发者ID:GeirGrusom,项目名称:ModGL,代码行数:7,代码来源:Renderer.cs
示例11: OperandRewriter
public OperandRewriter(M68kArchitecture arch, RtlEmitter emitter, Frame frame, PrimitiveType dataWidth)
{
this.arch = arch;
this.m = emitter;
this.frame = frame;
this.DataWidth = dataWidth;
}
开发者ID:nemerle,项目名称:reko,代码行数:7,代码来源:OperandRewriter.cs
示例12: RewriteFpu3
private void RewriteFpu3(PrimitiveType width, Func<Expression, Expression, Expression> fn, Action<Expression> genFlags)
{
var op1 = RewriteSrcOp(0, width);
var op2 = RewriteSrcOp(1, width);
var dst = RewriteDstOp(2, width, e => fn(op2, op1));
genFlags(dst);
}
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:VaxRewriter.Fpu.cs
示例13: CreateInstancedRequest
public IRenderRequest CreateInstancedRequest(IRenderContext renderContext, RasterizerState rasterizerState,
BlendState blendState, DepthStencilState depthStencilState, IEffect effect, IEffectParameterSet effectParameterSet,
VertexBuffer meshVertexBuffer, IndexBuffer meshIndexBuffer, PrimitiveType primitiveType,
Matrix[] instanceWorldTransforms, Action<List<Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
{
throw new NotImplementedException();
}
开发者ID:RedpointGames,项目名称:Protogame,代码行数:7,代码来源:NullRenderBatcher.cs
示例14: RrdPrimitive
public RrdPrimitive(RrdUpdater updater, PrimitiveType type, int count, bool isConstant)
{
backend = updater.getRrdBackend();
byteCount = RRD_PRIM_SIZES[(int)type] * count;
pointer = updater.getRrdAllocator().allocate(byteCount);
cachingAllowed = isConstant || backend.isCachingAllowed();
}
开发者ID:mujing,项目名称:rrd4net,代码行数:7,代码来源:RrdPrimitive.cs
示例15: Element
/// <summary>
/// Specify which elements shall be drawn by indexing them, specifying an offset and the number of elements.
/// </summary>
/// <param name="vao">
/// The <see cref="VertexArrayObject"/> to which this element belongs to.
/// </param>
/// <param name="mode">
/// A <see cref="PrimitiveType"/> that indicates how elements are interpreted.
/// </param>
protected Element(VertexArrayObject vao, PrimitiveType mode)
{
if (vao == null)
throw new ArgumentNullException("vao");
_VertexArrayObject = vao;
ElementsMode = mode;
}
开发者ID:rhynodegreat,项目名称:OpenGL.Net,代码行数:16,代码来源:VertexArrayObject.Elements.cs
示例16: OtfHeaderDecoder
/// <summary>
/// Read the message header structure and cache the meta data for finding the key fields for decoding messages.
/// </summary>
/// <param name="headerStructure"> for the meta data describing the message header. </param>
public OtfHeaderDecoder(HeaderStructure headerStructure)
{
_size = headerStructure.Tokens[0].Size;
foreach (Token token in headerStructure.Tokens)
{
switch (token.Name)
{
case HeaderStructure.BlockLength:
_blockLengthOffset = token.Offset;
_blockLengthType = token.Encoding.PrimitiveType;
_blockLengthByteOrder = token.Encoding.ByteOrder;
break;
case HeaderStructure.TemplateId:
_templateIdOffset = token.Offset;
_templateIdType = token.Encoding.PrimitiveType;
_templateIdByteOrder = token.Encoding.ByteOrder;
break;
case HeaderStructure.SchemaId:
_schemaIdOffset = token.Offset;
_schemaIdType = token.Encoding.PrimitiveType;
_schemaIdByteOrder = token.Encoding.ByteOrder;
break;
case HeaderStructure.SchemaVersion:
_schemaVersionOffset = token.Offset;
_schemaVersionType = token.Encoding.PrimitiveType;
_schemaVersionByteOrder = token.Encoding.ByteOrder;
break;
}
}
}
开发者ID:nivertech,项目名称:simple-binary-encoding,代码行数:38,代码来源:OtfHeaderDecoder.cs
示例17: IsValidVertexCount
/// <summary>
/// Checks whether a vertex count is valid for the specified type of primitives
/// </summary>
/// <param name="verticesOrIndices">Number of vertices or indices</param>
/// <param name="type">Type of primitives the vertices will be processed as</param>
/// <returns>
/// True if the specified number is a valid vertex count for the specified
/// type of primitives
/// </returns>
/// <remarks>
/// A zero check is expected to be done in addition to this method. Negative
/// vertex or index counts will result in undefined behavior.
/// </remarks>
public static bool IsValidVertexCount(int verticesOrIndices, PrimitiveType type) {
switch(type) {
#if !XNA_4
case PrimitiveType.PointList: {
return true;
}
#endif
case PrimitiveType.LineStrip: {
return (verticesOrIndices >= 2);
}
case PrimitiveType.LineList: {
return ((verticesOrIndices % 2) == 0);
}
#if !XNA_4
case PrimitiveType.TriangleFan:
#endif
case PrimitiveType.TriangleStrip: {
return (verticesOrIndices >= 3);
}
case PrimitiveType.TriangleList: {
return (verticesOrIndices % 3) == 0;
}
default: { throw new ArgumentException("Invalid primitive type"); }
}
}
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:38,代码来源:VertexHelper.cs
示例18: Primitive
public Primitive()
{
id = Guid.NewGuid().ToString();
type = PrimitiveType.None;
edges = new List<Edge>();
nodes = new List<Node>();
}
开发者ID:famerij,项目名称:EdgeGraph,代码行数:7,代码来源:Primitive.cs
示例19: VertexArray
public VertexArray(PrimitiveType primitive)
{
this.id = GL.GenVertexArray();
this.primitive = primitive;
this.arrays = new Dictionary<string, GLBuffer>();
this.attributes = new Dictionary<int, VertexAttribute>();
}
开发者ID:johanhenriksson,项目名称:univ,代码行数:7,代码来源:VertexArray.cs
示例20: ToType
/// <summary>
/// Converts a javascript primitive type to a .NET type.
/// </summary>
/// <param name="type"> The type to convert. </param>
/// <returns> A .NET type. </returns>
public static Type ToType(PrimitiveType type)
{
switch (type)
{
case PrimitiveType.Any:
return typeof(object);
case PrimitiveType.Undefined:
return typeof(Undefined);
case PrimitiveType.Null:
return typeof(Null);
case PrimitiveType.Bool:
return typeof(bool);
case PrimitiveType.Int32:
return typeof(int);
case PrimitiveType.UInt32:
return typeof(uint);
case PrimitiveType.Number:
return typeof(double);
case PrimitiveType.String:
return typeof(string);
case PrimitiveType.ConcatenatedString:
return typeof(ConcatenatedString);
case PrimitiveType.Object:
return typeof(Library.ObjectInstance);
default:
throw new NotImplementedException(string.Format("Unsupported primitive type: {0}", type));
}
}
开发者ID:vipwan,项目名称:CommunityServer,代码行数:33,代码来源:PrimitiveTypeUtilities.cs
注:本文中的PrimitiveType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论