sdf-2d/docs/interfaces/renderer.html

472 lines
No EOL
22 KiB
HTML

<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Renderer | SDF-2D - v0.3.2</title>
<meta name="description" content="Documentation for SDF-2D - v0.3.2">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="icon" href="../favicon.ico" />
</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.json" 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">SDF-2D - v0.3.2</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>
</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="../globals.html">Globals</a>
</li>
<li>
<a href="renderer.html">Renderer</a>
</li>
</ul>
<h1>Interface Renderer</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>The main interface through which rendering can be achieved.</p>
</div>
<p>Multiple renderers are permitted on a single page.</p>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">Renderer</span>
</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 ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="renderer.html#canvassize" class="tsd-kind-icon">canvas<wbr>Size</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="renderer.html#insights" class="tsd-kind-icon">insights</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="renderer.html#viewareasize" class="tsd-kind-icon">view<wbr>Area<wbr>Size</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-interface tsd-has-type-parameter"><a href="renderer.html#adddrawable" class="tsd-kind-icon">add<wbr>Drawable</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="renderer.html#autoscalequality" class="tsd-kind-icon">autoscale<wbr>Quality</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="renderer.html#destroy" class="tsd-kind-icon">destroy</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="renderer.html#renderdrawables" class="tsd-kind-icon">render<wbr>Drawables</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="renderer.html#setruntimesettings" class="tsd-kind-icon">set<wbr>Runtime<wbr>Settings</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="renderer.html#setviewarea" class="tsd-kind-icon">set<wbr>View<wbr>Area</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="canvassize" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagReadonly">Readonly</span> canvas<wbr>Size</h3>
<div class="tsd-signature tsd-kind-icon">canvas<wbr>Size<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">vec2</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L14">graphics/rendering/renderer/renderer.ts:14</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Get the actual resolution of the canvas.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="insights" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagReadonly">Readonly</span> insights</h3>
<div class="tsd-signature tsd-kind-icon">insights<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L69">graphics/rendering/renderer/renderer.ts:69</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>experimental</dt>
<dd><p>Debug information updated on each <code>renderDrawables</code> call.
Its scheme is not yet defined. The main purpose of this is
human debugging.</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="viewareasize" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagReadonly">Readonly</span> view<wbr>Area<wbr>Size</h3>
<div class="tsd-signature tsd-kind-icon">view<wbr>Area<wbr>Size<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">vec2</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L21">graphics/rendering/renderer/renderer.ts:21</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Get the viewArea size set by the last <code>setViewArea</code>.</p>
</div>
<p>By default, <code>canvasSize</code> is used for the view area size.</p>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface tsd-has-type-parameter">
<a name="adddrawable" class="tsd-anchor"></a>
<h3>add<wbr>Drawable</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface tsd-has-type-parameter">
<li class="tsd-signature tsd-kind-icon">add<wbr>Drawable&lt;T&gt;<span class="tsd-signature-symbol">(</span>drawable<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">T</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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L44">graphics/rendering/renderer/renderer.ts:44</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Schedule a drawable to be rendered during the next <code>renderDrawables</code> call.</p>
</div>
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
<h4>T<span class="tsd-signature-symbol">: </span><a href="../classes/drawable.html" class="tsd-signature-type">Drawable</a></h4>
</li>
</ul>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>drawable: <span class="tsd-signature-type">T</span></h5>
<div class="tsd-comment tsd-typography">
<p>Must be a subclass of drawable and its class must contain a
static descriptor property of type <a href="drawabledescriptor.html">DrawableDescriptor</a>.</p>
</div>
</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-interface">
<a name="autoscalequality" class="tsd-anchor"></a>
<h3>autoscale<wbr>Quality</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">autoscale<wbr>Quality<span class="tsd-signature-symbol">(</span>deltaTime<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DOMHighResTimeStamp</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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L79">graphics/rendering/renderer/renderer.ts:79</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>experimental</dt>
<dd><p>Scale the render scale for both the canvas and the SDF memoization based
on the current and historical FPS values.</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>deltaTime: <span class="tsd-signature-type">DOMHighResTimeStamp</span></h5>
<div class="tsd-comment tsd-typography">
<p>since the last frame, in milliseconds.</p>
</div>
</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-interface">
<a name="destroy" class="tsd-anchor"></a>
<h3>destroy</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">destroy<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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L60">graphics/rendering/renderer/renderer.ts:60</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Let go of every GPU resource held by the renderer.</p>
</div>
<p>It&#39;s up to the browser and driver whether these resources are actually freed.
Nonetheless, when a renderer is no longer needed, this method should be called.</p>
</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-interface">
<a name="renderdrawables" class="tsd-anchor"></a>
<h3>render<wbr>Drawables</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">render<wbr>Drawables<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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L52">graphics/rendering/renderer/renderer.ts:52</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Render every drawable added since the last <code>renderDrawables</code> call.</p>
</div>
<p>Resizing of framebuffers and the canvas also takes effect
when calling <code>renderDrawables</code>.</p>
</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-interface">
<a name="setruntimesettings" class="tsd-anchor"></a>
<h3>set<wbr>Runtime<wbr>Settings</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">set<wbr>Runtime<wbr>Settings<span class="tsd-signature-symbol">(</span>overrides<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="runtimesettings.html" class="tsd-signature-type">RuntimeSettings</a><span class="tsd-signature-symbol">&gt;</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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L36">graphics/rendering/renderer/renderer.ts:36</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Patch the current runtime settings with new values.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>overrides: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="runtimesettings.html" class="tsd-signature-type">RuntimeSettings</a><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
</div>
</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-interface">
<a name="setviewarea" class="tsd-anchor"></a>
<h3>set<wbr>View<wbr>Area</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">set<wbr>View<wbr>Area<span class="tsd-signature-symbol">(</span>topLeft<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">vec2</span>, size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">vec2</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/schmelczerandras/sdf-2d/blob/0fed4f4/src/graphics/rendering/renderer/renderer.ts#L30">graphics/rendering/renderer/renderer.ts:30</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Set the camera transformation.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>topLeft: <span class="tsd-signature-type">vec2</span></h5>
<div class="tsd-comment tsd-typography">
<p>top (!) left. By default, equals to [0, canvasHeight].</p>
</div>
</li>
<li>
<h5>size: <span class="tsd-signature-type">vec2</span></h5>
<div class="tsd-comment tsd-typography">
<p>need not be equal to the canvas size, though their aspect ratio
should be the same to avoid stretching.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class">
<a href="../classes/circle.html" class="tsd-kind-icon">Circle</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/circlelight.html" class="tsd-kind-icon">Circle<wbr>Light</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/drawable.html" class="tsd-kind-icon">Drawable</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/flashlight.html" class="tsd-kind-icon">Flashlight</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/invertedtunnel.html" class="tsd-kind-icon">Inverted<wbr>Tunnel</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/rotatedrectangle.html" class="tsd-kind-icon">Rotated<wbr>Rectangle</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/tunnel.html" class="tsd-kind-icon">Tunnel</a>
</li>
<li class=" tsd-kind-interface">
<a href="drawabledescriptor.html" class="tsd-kind-icon">Drawable<wbr>Descriptor</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface">
<a href="renderer.html" class="tsd-kind-icon">Renderer</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="renderer.html#canvassize" class="tsd-kind-icon">canvas<wbr>Size</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="renderer.html#insights" class="tsd-kind-icon">insights</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="renderer.html#viewareasize" class="tsd-kind-icon">view<wbr>Area<wbr>Size</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface tsd-has-type-parameter">
<a href="renderer.html#adddrawable" class="tsd-kind-icon">add<wbr>Drawable</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="renderer.html#autoscalequality" class="tsd-kind-icon">autoscale<wbr>Quality</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="renderer.html#destroy" class="tsd-kind-icon">destroy</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="renderer.html#renderdrawables" class="tsd-kind-icon">render<wbr>Drawables</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="renderer.html#setruntimesettings" class="tsd-kind-icon">set<wbr>Runtime<wbr>Settings</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="renderer.html#setviewarea" class="tsd-kind-icon">set<wbr>View<wbr>Area</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface">
<a href="runtimesettings.html" class="tsd-kind-icon">Runtime<wbr>Settings</a>
</li>
<li class=" tsd-kind-interface">
<a href="startupsettings.html" class="tsd-kind-icon">Startup<wbr>Settings</a>
</li>
<li class=" tsd-kind-function">
<a href="../globals.html#compile" class="tsd-kind-icon">compile</a>
</li>
<li class=" tsd-kind-object-literal">
<a href="../globals.html#defaultruntimesettings" class="tsd-kind-icon">default<wbr>Runtime<wbr>Settings</a>
</li>
<li class=" tsd-kind-object-literal">
<a href="../globals.html#defaultstartupsettings" class="tsd-kind-icon">default<wbr>Startup<wbr>Settings</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
</ul>
</div>
</div>
</footer>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>