简体   繁体   English

在 SFML 顶点数组中组合基元

[英]Combining Primitives in SFML Vertex Arrays

Thedocumentation for SFML states that you can combine primitives to create vertex arrays. SFML 的文档说明您可以组合基元来创建顶点数组。 I think what they are referring to is the fact that multiple Triangles can be grouped into a TriangleFan or TriangleStrip .我认为他们所指的是多个Triangles可以分组为TriangleFanTriangleStrip的事实。

I'm wondering whether there is a way to combine two existing primitive types in a single vertex array.我想知道是否有办法在单个顶点数组中组合两个现有的原始类型。 For example, could I define a bunch of vertices as a TriangleFan and then switch over to a LineStrip ?例如,我可以将一堆顶点定义为TriangleFan然后切换到LineStrip吗? Or would this require two separate arrays?或者这是否需要两个单独的数组?

No, you can only use one primitive type per vertex array.不,每个顶点数组只能使用一种基本类型。

With the following draw function you could theoretically use one array/vector (not sf::VertexArray and provide different offsets and sizes to draw different parts of the array with different primitive types, but that's effectively the same thing as using two different arrays and thus you'll need to ask yourself what the gain is in mixing these vertices together.使用以下绘制函数,理论上您可以使用一个数组/向量(不是sf::VertexArray并提供不同的偏移量和大小来绘制具有不同基元类型的数组的不同部分,但这实际上与使用两个不同的数组相同,因此你需要问问自己将这些顶点混合在一起有什么好处。

void draw(const Vertex *vertices, std::size_t vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM