import Texture from "../textures/Texture"; import MeshStyle from "../styles/MeshStyle"; import VertexDataFormat from "../rendering/VertexDataFormat"; import VertexData from "../rendering/VertexData"; import Painter from "../rendering/Painter"; import IndexData from "../rendering/IndexData"; import Polygon from "../geom/Polygon"; import DisplayObject from "./DisplayObject"; import Rectangle from "openfl/geom/Rectangle"; import Point from "openfl/geom/Point"; declare namespace starling.display { /** * The base class for all tangible (non-container) display objects, spawned up by a number * * of triangles. * * * *
Since Starling uses Stage3D for rendering, all rendered objects must be constructed * * from triangles. A mesh stores the information of its triangles through VertexData and * * IndexData structures. The default format stores position, color and texture coordinates * * for each vertex.
* * * *How a mesh is rendered depends on its style. Per default, this is an instance
* * of the MeshStyle base class; however, subclasses may extend its behavior
* * to add support for color transformations, normal mapping, etc.
MeshStyle will be created
* * for you. Note that the format of the vertex data will be matched to the
* * given style right away.
*/
constructor(vertexData: VertexData, indexData: IndexData, style?: MeshStyle);
/**
* Creates a new instance of the current default MeshStyle. Internally, this method
* * calls either the defaultStyleFactory or (if no factory has been assigned)
* * instantiates defaultStyle.
*
*/
static createDefaultStyle(instance?: Mesh): MeshStyle;
/**
* The default style used for meshes if no specific style is provided. The default is
* * starling.rendering.MeshStyle, and any assigned class must be a subclass
* * of the same.
*/
static get defaultStyle(): any;
static set defaultStyle(value: any)
/**
* A factory method that is used to create the 'MeshStyle' for a mesh if no specific
* * style is provided. That's useful if you are creating a hierarchy of objects, all
* * of which need to have a certain style. Different to the defaultStyle
* * property, this method allows plugging in custom logic and passing arguments to the
* * constructor. Return null to fall back to the default behavior (i.e.
* * to instantiate defaultStyle). The mesh-parameter is optional
* * and may be omitted.
* *
* * MeshStyle) provide a means to completely modify the way a mesh is rendered.
* * For example, they may add support for color transformations or normal mapping.
* *
* * When assigning a new style, the vertex format will be changed to fit it.
* * Do not use the same style instance on multiple objects! Instead, make use of
* * style.clone() to assign an identical style to multiple meshes.
null, the default
* * style will be created.
* * @param mergeWithPredecessor if enabled, all attributes of the previous style will be
* * be copied to the new one, if possible.
* * @see #defaultStyle
* * @see #defaultStyleFactory
*
*/
setStyle(meshStyle?: MeshStyle, mergeWithPredecessor?: boolean): void;
/**
* This method is called whenever the mesh's vertex data was changed.
* * The base implementation simply forwards to setRequiresRedraw.
*/
setVertexDataChanged(): void;
/**
* This method is called whenever the mesh's index data was changed.
* * The base implementation simply forwards to setRequiresRedraw.
*/
setIndexDataChanged(): void;
/**
* The position of the vertex at the specified index, in the mesh's local coordinate
* * system.
* *
* * Only modify the position of a vertex if you know exactly what you're doing, as
* * some classes might not work correctly when their vertices are moved. E.g. the
* * Quad class expects its vertices to spawn up a perfectly rectangular
* * area; some of its optimized methods won't work correctly if that premise is no longer
* * fulfilled or the original bounds change.
MeshStyle) provide a means to completely modify the way a mesh is rendered.
* * For example, they may add support for color transformations or normal mapping.
* * Beware: a style instance may only be used on one mesh at a time.
* *
* * @default MeshStyle
* * @see #setStyle()
*
*/
get style(): MeshStyle;
set style(value: MeshStyle)
/**
* The texture that is mapped to the mesh (or null, if there is none).
*/
get texture(): Texture;
set texture(value: Texture)
/**
* Changes the color of all vertices to the same value.
* * The getter simply returns the color of the first vertex.
*/
get color(): number;
set color(value: number)
/**
* The smoothing filter that is used for the texture.
* * @default bilinear
*/
get textureSmoothing(): string;
set textureSmoothing(value: string)
/**
* Indicates if pixels at the edges will be repeated or clamped. Only works for
* * power-of-two textures; for a solution that works with all kinds of textures,
* * see Image.tileGrid. @default false
*/
get textureRepeat(): boolean;
set textureRepeat(value: boolean)
/**
* Controls whether or not the instance snaps to the nearest pixel. This can prevent the
* * object from looking blurry when it's not exactly aligned with the pixels of the screen.
* * @default false
*/
get pixelSnapping(): boolean;
set pixelSnapping(value: boolean)
/**
* The total number of vertices in the mesh.
*/
get numVertices(): number;
/**
* The total number of indices referencing vertices.
*/
get numIndices(): number;
/**
* The total number of triangles in this mesh.
* * (In other words: the number of indices divided by three.)
*/
get numTriangles(): number;
/**
* The format used to store the vertices.
*/
get vertexFormat(): VertexDataFormat;
}
}
export default starling.display.Mesh;