import VertexBuffer3D from "openfl/display3D/VertexBuffer3D"; declare namespace starling.rendering { /** * Describes the memory layout of VertexData instances, as used for every single vertex. * * * *
The format is set up via a simple String. Here is an example:
* * * *This String describes two attributes: "position" and "color". The keywords after
* * the colons depict the format and size of the data that each attribute uses; in this
* * case, we store two floats for the position (taking up the x- and y-coordinates) and four
* * bytes for the color. (The available formats are the same as those defined in the
* * Context3DVertexBufferFormat class:
* * float1, float2, float3, float4, bytes4.)
You cannot create a VertexData instance with its constructor; instead, you must use the
* * static fromString-method. The reason for this behavior: the class maintains
* * a cache, and a call to fromString will return an existing instance if an
* * equivalent format has already been created in the past. That saves processing time and
* * memory.
VertexDataFormat instances are immutable, i.e. they are solely defined by their format * * string and cannot be changed later.
* * * * @see VertexData * */ export class VertexDataFormat { /** * Don't use the constructor, but callVertexDataFormat.fromString instead.
* * This allows for efficient format caching.
*/
constructor();
/**
* Creates a new VertexDataFormat instance from the given String, or returns one from
* * the cache (if an equivalent String has already been used before).
* *
* * @param format
* *
* * Describes the attributes of each vertex, consisting of a comma-separated
* * list of attribute names and their format, e.g.:
* *
* * "position:float2, texCoords:float2, color:bytes4"* * * *
This set of attributes will be allocated for each vertex, and they will be * * stored in exactly the given order.
* * * *Context3DVertexBufferFormat
* * class in the flash.display3D package.bytes4 for color data that you want to access with the
* * respective methods.float1, float2, float3, float4, bytes4.
*/
getFormat(attrName: string): string;
/**
* Returns the name of the attribute at the given position within the vertex format.
*/
getName(attrIndex: number): string;
/**
* Indicates if the format contains an attribute with the given name.
*/
hasAttribute(attrName: string): boolean;
/**
* Specifies which vertex data attribute corresponds to a single vertex shader
* * program input. This wraps the Context3D-method with the same name,
* * automatically replacing attrName with the corresponding values for
* * bufferOffset and format.
*/
setVertexBufferAt(index: number, buffer: VertexBuffer3D, attrName: string): void;
/**
* Returns the normalized format string.
*/
toString(): string;
/**
* Returns the normalized format string.
*/
get formatString(): string;
/**
* The size (in bytes) of each vertex.
*/
get vertexSize(): number;
/**
* The size (in 32 bit units) of each vertex.
*/
get vertexSizeIn32Bits(): number;
/**
* The number of attributes per vertex.
*/
get numAttributes(): number;
}
}
export default starling.rendering.VertexDataFormat;