本文整理汇总了C#中PrimitiveType类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveType类的具体用法?C# PrimitiveType怎么用?C# PrimitiveType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveType类属于命名空间,在下文中一共展示了PrimitiveType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Mesh
public Mesh(int vbo, int ibo, int count, PrimitiveType mode)
{
VboId = vbo;
IboId = ibo;
Count = count;
Mode = mode;
}
示例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();
}
示例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++;
}
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
}
示例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;
}
示例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);
}
示例10: Draw
public void Draw(PrimitiveType mode, IElementArray elements)
{
using (elements.Bind())
{
_gl.DrawElements(mode, (int)elements.Elements, (uint)elements.Type, IntPtr.Zero);
}
}
示例11: OperandRewriter
public OperandRewriter(M68kArchitecture arch, RtlEmitter emitter, Frame frame, PrimitiveType dataWidth)
{
this.arch = arch;
this.m = emitter;
this.frame = frame;
this.DataWidth = dataWidth;
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}