Skia
2D Graphics Library
|
A vertex buffer, a topology, optionally an index buffer, and a compatible SkMeshSpecification. More...
#include <SkMesh.h>
Classes | |
class | IndexBuffer |
struct | Result |
class | VertexBuffer |
Public Types | |
enum class | Mode { kTriangles , kTriangleStrip } |
using | ChildPtr = SkRuntimeEffect::ChildPtr |
Public Member Functions | |
SkMesh () | |
~SkMesh () | |
SkMesh (const SkMesh &) | |
SkMesh (SkMesh &&) | |
SkMesh & | operator= (const SkMesh &) |
SkMesh & | operator= (SkMesh &&) |
sk_sp< SkMeshSpecification > | refSpec () const |
SkMeshSpecification * | spec () const |
Mode | mode () const |
sk_sp< VertexBuffer > | refVertexBuffer () const |
VertexBuffer * | vertexBuffer () const |
size_t | vertexOffset () const |
size_t | vertexCount () const |
sk_sp< IndexBuffer > | refIndexBuffer () const |
IndexBuffer * | indexBuffer () const |
size_t | indexOffset () const |
size_t | indexCount () const |
sk_sp< const SkData > | refUniforms () const |
const SkData * | uniforms () const |
SkSpan< const ChildPtr > | children () const |
SkRect | bounds () const |
bool | isValid () const |
Static Public Member Functions | |
static Result | Make (sk_sp< SkMeshSpecification >, Mode, sk_sp< VertexBuffer >, size_t vertexCount, size_t vertexOffset, sk_sp< const SkData > uniforms, SkSpan< ChildPtr > children, const SkRect &bounds) |
Creates a non-indexed SkMesh. More... | |
static Result | MakeIndexed (sk_sp< SkMeshSpecification >, Mode, sk_sp< VertexBuffer >, size_t vertexCount, size_t vertexOffset, sk_sp< IndexBuffer >, size_t indexCount, size_t indexOffset, sk_sp< const SkData > uniforms, SkSpan< ChildPtr > children, const SkRect &bounds) |
Creates an indexed SkMesh. More... | |
A vertex buffer, a topology, optionally an index buffer, and a compatible SkMeshSpecification.
The data in the vertex buffer is expected to contain the attributes described by the spec for vertexCount vertices, beginning at vertexOffset. vertexOffset must be aligned to the SkMeshSpecification's vertex stride. The size of the buffer must be at least vertexOffset + spec->stride()*vertexCount (even if vertex attributes contains pad at the end of the stride). If the specified bounds do not contain all the points output by the spec's vertex program when applied to the vertices in the custom mesh, then the result is undefined.
MakeIndexed may be used to create an indexed mesh. indexCount indices are read from the index buffer at the specified offset, which must be aligned to 2. The indices are always unsigned 16-bit integers. The index count must be at least 3.
If Make() is used, the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at least 3.
Both Make() and MakeIndexed() take a SkData with the uniform values. See SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing uniforms into the SkData.
|
strong |
SkMesh::SkMesh | ( | ) |
SkMesh::~SkMesh | ( | ) |
SkMesh::SkMesh | ( | const SkMesh & | ) |
SkMesh::SkMesh | ( | SkMesh && | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool SkMesh::isValid | ( | ) | const |
|
static |
Creates a non-indexed SkMesh.
The returned SkMesh can be tested for validity using SkMesh::isValid(). An invalid mesh simply fails to draws if passed to SkCanvas::drawMesh(). If the mesh is invalid the returned string give contain the reason for the failure (e.g. the vertex buffer was null or uniform data too small).
|
static |
Creates an indexed SkMesh.
The returned SkMesh can be tested for validity using SkMesh::isValid(). A invalid mesh simply fails to draw if passed to SkCanvas::drawMesh(). If the mesh is invalid the returned string give contain the reason for the failure (e.g. the index buffer was null or uniform data too small).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |