UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

823 lines 71.9 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Effect | starling-framework</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">starling-framework</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../index.html">starling</a> </li> <li> <a href="../modules/starling.rendering.html">rendering</a> </li> <li> <a href="starling.rendering.effect.html">Effect</a> </li> </ul> <h1>Class Effect</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>An effect encapsulates all steps of a Stage3D draw operation. It configures the render context and sets up shader programs as well as index- and vertex-buffers, thus providing the basic mechanisms of all low-level rendering.</p> </div> <p><strong>Using the Effect class</strong></p> <p>Effects are mostly used by the <code>MeshStyle</code> and <code>FragmentFilter</code> classes. When you extend those classes, you&#39;ll be required to provide a custom effect. Setting it up for rendering is done by the base class, though, so you rarely have to initiate the rendering yourself. Nevertheless, it&#39;s good to know how an effect is doing its work.</p> <p>Using an effect always follows steps shown in the example below. You create the effect, configure it, upload vertex data and then: draw!</p> <listing> // create effect effect:MeshEffect = new MeshEffect(); // configure effect effect.mvpMatrix3D = painter.state.mvpMatrix3D; effect.texture = getHeroTexture(); effect.color = 0xf0f0f0; // upload vertex data effect.uploadIndexData(indexData); effect.uploadVertexData(vertexData); // draw! effect.render(0, numTriangles);</listing> <p>Note that the <code>VertexData</code> being uploaded has to be created with the same format as the one returned by the effect&#39;s <code>vertexFormat</code> property.</p> <p><strong>Extending the Effect class</strong></p> <p>The base <code>Effect</code>-class can only render white triangles, which is not much use in itself. However, it is designed to be extended; subclasses can easily implement any kinds of shaders.</p> <p>Normally, you won&#39;t extend this class directly, but either <code>FilterEffect</code> or <code>MeshEffect</code>, depending on your needs (i.e. if you want to create a new fragment filter or a new mesh style). Whichever base class you&#39;re extending, you should override the following methods:</p> <ul> <li><code>createProgram():Program</code> — must create the actual program containing vertex- and fragment-shaders. A program will be created only once for each render context; this is taken care of by the base class.</li> <li><code>get programVariantName():number</code> (optional) — override this if your effect requires different programs, depending on its settings. The recommended way to do this is via a bit-mask that uniquely encodes the current settings.</li> <li><code>get vertexFormat():String</code> (optional) — must return the <code>VertexData</code> format that this effect requires for its vertices. If the effect does not require any special attributes, you can leave this out.</li> <li><code>beforeDraw(context:Context3D):void</code> — Set up your context by configuring program constants and buffer attributes.</li> <li><code>afterDraw(context:Context3D):void</code> — Will be called directly after <code>context.drawTriangles()</code>. Clean up any context configuration here.</li> </ul> <p>Furthermore, you need to add properties that manage the data you require on rendering, e.g. the texture(s) that should be used, program constants, etc. I recommend looking at the implementations of Starling&#39;s <code>FilterEffect</code> and <code>MeshEffect</code> classes to see how to approach sub-classing.</p> <p> @see FilterEffect @see MeshEffect @see starling.styles.MeshStyle @see starling.filters.FragmentFilter @see starling.utils.RenderUtil</p> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">Effect</span> <ul class="tsd-hierarchy"> <li> <a href="starling.rendering.filtereffect.html" class="tsd-signature-type">FilterEffect</a> </li> </ul> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section tsd-is-external"> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section tsd-is-external"> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#indexbuffer" class="tsd-kind-icon">index<wbr>Buffer</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#indexbuffersize" class="tsd-kind-icon">index<wbr>Buffer<wbr>Size</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#mvpmatrix3d" class="tsd-kind-icon">mvp<wbr>Matrix3D</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#onrestore" class="tsd-kind-icon">on<wbr>Restore</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#program" class="tsd-kind-icon">program</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#programbasename" class="tsd-kind-icon">program<wbr>Base<wbr>Name</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#programname" class="tsd-kind-icon">program<wbr>Name</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#programvariantname" class="tsd-kind-icon">program<wbr>Variant<wbr>Name</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#vertexbuffer" class="tsd-kind-icon">vertex<wbr>Buffer</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#vertexbuffersize" class="tsd-kind-icon">vertex<wbr>Buffer<wbr>Size</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#vertexformat" class="tsd-kind-icon">vertex<wbr>Format</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.rendering.effect.html#vertex_format" class="tsd-kind-icon">VERTEX_<wbr>FORMAT</a></li> </ul> </section> <section class="tsd-index-section tsd-is-external"> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#dispose" class="tsd-kind-icon">dispose</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_indexbuffer" class="tsd-kind-icon">get_<wbr>index<wbr>Buffer</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_indexbuffersize" class="tsd-kind-icon">get_<wbr>index<wbr>Buffer<wbr>Size</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_mvpmatrix3d" class="tsd-kind-icon">get_<wbr>mvp<wbr>Matrix3D</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_onrestore" class="tsd-kind-icon">get_<wbr>on<wbr>Restore</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_program" class="tsd-kind-icon">get_<wbr>program</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_programbasename" class="tsd-kind-icon">get_<wbr>program<wbr>Base<wbr>Name</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_programname" class="tsd-kind-icon">get_<wbr>program<wbr>Name</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_programvariantname" class="tsd-kind-icon">get_<wbr>program<wbr>Variant<wbr>Name</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_vertexbuffer" class="tsd-kind-icon">get_<wbr>vertex<wbr>Buffer</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_vertexbuffersize" class="tsd-kind-icon">get_<wbr>vertex<wbr>Buffer<wbr>Size</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#get_vertexformat" class="tsd-kind-icon">get_<wbr>vertex<wbr>Format</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#purgebuffers" class="tsd-kind-icon">purge<wbr>Buffers</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#render" class="tsd-kind-icon">render</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#set_mvpmatrix3d" class="tsd-kind-icon">set_<wbr>mvp<wbr>Matrix3D</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#set_onrestore" class="tsd-kind-icon">set_<wbr>on<wbr>Restore</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.rendering.effect.html#set_programbasename" class="tsd-kind-icon">set_<wbr>program<wbr>Base<wbr>Name</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#uploadindexdata" class="tsd-kind-icon">upload<wbr>Index<wbr>Data</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.rendering.effect.html#uploadvertexdata" class="tsd-kind-icon">upload<wbr>Vertex<wbr>Data</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-external"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">new <wbr>Effect<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.rendering.effect.html" class="tsd-signature-type">Effect</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L90">lib/starling/rendering/Effect.d.ts:90</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a new effect.</p> </div> </div> <h4 class="tsd-returns-title">Returns <a href="starling.rendering.effect.html" class="tsd-signature-type">Effect</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="indexbuffer" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> index<wbr>Buffer</h3> <div class="tsd-signature tsd-kind-icon">index<wbr>Buffer<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IndexBuffer3D</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L182">lib/starling/rendering/Effect.d.ts:182</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The internally used index buffer used on rendering.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="indexbuffersize" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> index<wbr>Buffer<wbr>Size</h3> <div class="tsd-signature tsd-kind-icon">index<wbr>Buffer<wbr>Size<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L186">lib/starling/rendering/Effect.d.ts:186</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The current size of the index buffer (in number of indices).</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="mvpmatrix3d" class="tsd-anchor"></a> <h3>mvp<wbr>Matrix3D</h3> <div class="tsd-signature tsd-kind-icon">mvp<wbr>Matrix3D<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Matrix3D</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L177">lib/starling/rendering/Effect.d.ts:177</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The MVP (modelview-projection) matrix transforms vertices into clipspace.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="onrestore" class="tsd-anchor"></a> <h3>on<wbr>Restore</h3> <div class="tsd-signature tsd-kind-icon">on<wbr>Restore<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">function</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L167">lib/starling/rendering/Effect.d.ts:167</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The that you provide here will be called after a context loss. Call both &quot;upload...&quot; methods from within the callback to restore any vertex or index buffers. The callback will be executed with the effect as its sole parameter.</p> </div> </div> <div class="tsd-type-declaration"> <h4>Type declaration</h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-property"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>Effect<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>Effect: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="program" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> program</h3> <div class="tsd-signature tsd-kind-icon">program<span class="tsd-signature-symbol">:</span> <a href="starling.rendering.program.html" class="tsd-signature-type">Program</a></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L159">lib/starling/rendering/Effect.d.ts:159</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the current program, either by creating a new one (via <code>createProgram</code>) or by getting it from the <code>Painter</code>. Do not override this method! Instead, implement <code>createProgram</code>.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="programbasename" class="tsd-anchor"></a> <h3>program<wbr>Base<wbr>Name</h3> <div class="tsd-signature tsd-kind-icon">program<wbr>Base<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L142">lib/starling/rendering/Effect.d.ts:142</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the base name for the program. @default the fully qualified class name</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="programname" class="tsd-anchor"></a> <h3>program<wbr>Name</h3> <div class="tsd-signature tsd-kind-icon">program<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L153">lib/starling/rendering/Effect.d.ts:153</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns the full name of the program, which is used to register it at the current <code>Painter</code>.</p> </div> <p>The default implementation efficiently combines the program&#39;s base and variant names (e.g. <code>LightEffect#42</code>). It shouldn&#39;t be necessary to override this method.</p> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="programvariantname" class="tsd-anchor"></a> <h3>program<wbr>Variant<wbr>Name</h3> <div class="tsd-signature tsd-kind-icon">program<wbr>Variant<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L136">lib/starling/rendering/Effect.d.ts:136</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Override this method if the effect requires a different program depending on the current settings. Ideally, you do this by creating a bit mask encoding all the options. This method is called often, so do not allocate any temporary objects when overriding.</p> </div> <p> @default 0</p> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="vertexbuffer" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> vertex<wbr>Buffer</h3> <div class="tsd-signature tsd-kind-icon">vertex<wbr>Buffer<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">VertexBuffer3D</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L190">lib/starling/rendering/Effect.d.ts:190</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The internally used vertex buffer used on rendering.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="vertexbuffersize" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> vertex<wbr>Buffer<wbr>Size</h3> <div class="tsd-signature tsd-kind-icon">vertex<wbr>Buffer<wbr>Size<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L194">lib/starling/rendering/Effect.d.ts:194</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The current size of the vertex buffer (in blocks of 32 bits).</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external"> <a name="vertexformat" class="tsd-anchor"></a> <h3>vertex<wbr>Format</h3> <div class="tsd-signature tsd-kind-icon">vertex<wbr>Format<span class="tsd-signature-symbol">:</span> <a href="starling.rendering.vertexdataformat.html" class="tsd-signature-type">VertexDataFormat</a></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L173">lib/starling/rendering/Effect.d.ts:173</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The data format that this effect requires from the VertexData that it renders: <code>&quot;position:number2&quot;</code></p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"> <a name="vertex_format" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> VERTEX_<wbr>FORMAT</h3> <div class="tsd-signature tsd-kind-icon">VERTEX_<wbr>FORMAT<span class="tsd-signature-symbol">:</span> <a href="starling.rendering.vertexdataformat.html" class="tsd-signature-type">VertexDataFormat</a></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L90">lib/starling/rendering/Effect.d.ts:90</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>The vertex format expected by <code>uploadVertexData</code>: <code>&quot;position:number2&quot;</code></p> </div> </div> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="dispose" class="tsd-anchor"></a> <h3>dispose</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">dispose<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L96">lib/starling/rendering/Effect.d.ts:96</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Purges the index- and vertex-buffers.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_indexbuffer" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>index<wbr>Buffer</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>index<wbr>Buffer<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">IndexBuffer3D</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L183">lib/starling/rendering/Effect.d.ts:183</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IndexBuffer3D</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_indexbuffersize" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>index<wbr>Buffer<wbr>Size</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>index<wbr>Buffer<wbr>Size<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L187">lib/starling/rendering/Effect.d.ts:187</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_mvpmatrix3d" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>mvp<wbr>Matrix3D</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>mvp<wbr>Matrix3D<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Matrix3D</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L178">lib/starling/rendering/Effect.d.ts:178</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Matrix3D</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_onrestore" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>on<wbr>Restore</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>on<wbr>Restore<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L168">lib/starling/rendering/Effect.d.ts:168</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">function</span></h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>Effect<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>Effect: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_program" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>program</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>program<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.rendering.program.html" class="tsd-signature-type">Program</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L160">lib/starling/rendering/Effect.d.ts:160</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <a href="starling.rendering.program.html" class="tsd-signature-type">Program</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_programbasename" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>program<wbr>Base<wbr>Name</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>program<wbr>Base<wbr>Name<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L143">lib/starling/rendering/Effect.d.ts:143</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_programname" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>program<wbr>Name</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>program<wbr>Name<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L154">lib/starling/rendering/Effect.d.ts:154</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_programvariantname" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>program<wbr>Variant<wbr>Name</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>program<wbr>Variant<wbr>Name<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L137">lib/starling/rendering/Effect.d.ts:137</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_vertexbuffer" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>vertex<wbr>Buffer</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>vertex<wbr>Buffer<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">VertexBuffer3D</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L191">lib/starling/rendering/Effect.d.ts:191</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">VertexBuffer3D</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_vertexbuffersize" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>vertex<wbr>Buffer<wbr>Size</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>vertex<wbr>Buffer<wbr>Size<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L195">lib/starling/rendering/Effect.d.ts:195</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="get_vertexformat" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> get_<wbr>vertex<wbr>Format</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">get_<wbr>vertex<wbr>Format<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.rendering.vertexdataformat.html" class="tsd-signature-type">VertexDataFormat</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L174">lib/starling/rendering/Effect.d.ts:174</a></li> </ul> </aside> <h4 class="tsd-returns-title">Returns <a href="starling.rendering.vertexdataformat.html" class="tsd-signature-type">VertexDataFormat</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="purgebuffers" class="tsd-anchor"></a> <h3>purge<wbr>Buffers</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">purge<wbr>Buffers<span class="tsd-signature-symbol">(</span>vertexBuffer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, indexBuffer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L99">lib/starling/rendering/Effect.d.ts:99</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Purges one or both of the vertex- and index-buffers.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> vertexBuffer: <span class="tsd-signature-type">boolean</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> indexBuffer: <span class="tsd-signature-type">boolean</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external"> <a name="render" class="tsd-anchor"></a> <h3>render</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external"> <li class="tsd-signature tsd-kind-icon">render<span class="tsd-signature-symbol">(</span>firstIndex<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span>, numTriangles<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L128">lib/starling/rendering/Effect.d.ts:128</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Draws the triangles described by the index- and vertex-buffers, or a range of them. This calls <code>beforeDraw</code>, <code>context.drawTriangles</code>, and <code>afterDraw</code>, in this order.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> firstIndex: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> numTriangles: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="set_mvpmatrix3d" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> set_<wbr>mvp<wbr>Matrix3D</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">set_<wbr>mvp<wbr>Matrix3D<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Matrix3D</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Matrix3D</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L179">lib/starling/rendering/Effect.d.ts:179</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">Matrix3D</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Matrix3D</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="set_onrestore" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> set_<wbr>on<wbr>Restore</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <li class="tsd-signature tsd-kind-icon">set_<wbr>on<wbr>Restore<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/rendering/Effect.d.ts#L169">lib/starling/rendering/Effect.d.ts:169</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">function</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>Effect<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>Effect: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">function</span></h4> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>Effect<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>Effect: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"> <a name="set_programbasename" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> set_<wbr>program<wbr>Base<wbr>Name</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-i