mw-engine/docs/codox/mw-engine.heightmap.html

31 lines
8.9 KiB
HTML

<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>mw-engine.heightmap documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Mw-engine</span> <span class="project-version">0.2.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to mw-engine</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.heightmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>heightmap</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="mw-engine.world.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="mw-engine.heightmap.html#var-apply-heightmap"><div class="inner"><span>apply-heightmap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-apply-valuemap"><div class="inner"><span>apply-valuemap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-altitude"><div class="inner"><span>tag-altitude</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradient"><div class="inner"><span>tag-gradient</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradients"><div class="inner"><span>tag-gradients</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-property"><div class="inner"><span>tag-property</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.heightmap</h1><div class="doc"><div class="markdown"><p>Functions to apply a heightmap to a world.</p>
<p>Heightmaps are considered only as greyscale images, so colour is redundent (will be ignored). Darker shades are higher.</p>
</div></div><div class="public anchor" id="var-apply-heightmap"><h3>apply-heightmap</h3><div class="usage"><code>(apply-heightmap world imagepath)</code><code>(apply-heightmap imagepath)</code></div><div class="doc"><div class="markdown"><p>Apply the image file loaded from this path to this world, and return a world whose altitudes are modified (added to) by the altitudes in the heightmap. It is assumed that the heightmap is at least as large in x and y dimensions as the world. Note that, in addition to setting the <code>:altitude</code> of each cell, this function also sets the <code>:gradient</code>.</p>
<ul>
<li><code>world</code> a world, as defined in <code>world.clj</code>, q.v.; if world is not supplied, a world the size of the heightmap will be created;</li>
<li><code>imagepath</code> a file path or URL which indicates an (ideally greyscale) image file.</li>
</ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L90">view source</a></div></div><div class="public anchor" id="var-apply-valuemap"><h3>apply-valuemap</h3><div class="usage"><code>(apply-valuemap world imagepath property)</code></div><div class="doc"><div class="markdown"><p>Generalised from apply-heightmap, set an arbitrary property on each cell of this <code>world</code> from the values in this (ideally greyscale) heightmap.</p>
<ul>
<li><code>world</code> a world, as defined in <code>world.clj</code>, q.v.;</li>
<li><code>imagepath</code> a file path or URL which indicates an (ideally greyscale) image file;</li>
<li><code>property</code> the property of each cell whose value should be added to from the intensity of the corresponding cell of the image.</li>
</ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L115">view source</a></div></div><div class="public anchor" id="var-tag-altitude"><h3>tag-altitude</h3><div class="usage"><code>(tag-altitude _ cell heightmap)</code><code>(tag-altitude cell heightmap)</code></div><div class="doc"><div class="markdown"><p>Set the altitude of this cell from the corresponding pixel of this heightmap. If the heightmap you supply is smaller than the world, this will break.</p>
<ul>
<li><code>world</code> not actually used, but present to enable this function to be passed as an argument to <code>mw-engine.utils/map-world</code>, q.v.;</li>
<li><code>cell</code> a cell, as discussed in world.clj, q.v. Alternatively, a map;</li>
<li><code>heightmap</code> an (ideally) greyscale image, whose x and y dimensions should exceed those of the world of which the <code>cell</code> forms part.</li>
</ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L76">view source</a></div></div><div class="public anchor" id="var-tag-gradient"><h3>tag-gradient</h3><div class="usage"><code>(tag-gradient world cell)</code></div><div class="doc"><div class="markdown"><p>Set the <code>gradient</code> property of this <code>cell</code> of this <code>world</code> to the difference in altitude between its highest and lowest neghbours.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L58">view source</a></div></div><div class="public anchor" id="var-tag-gradients"><h3>tag-gradients</h3><div class="usage"><code>(tag-gradients world)</code></div><div class="doc"><div class="markdown"><p>Set the <code>gradient</code> property of each cell in this <code>world</code> to the difference in altitude between its highest and lowest neghbours.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L70">view source</a></div></div><div class="public anchor" id="var-tag-property"><h3>tag-property</h3><div class="usage"><code>(tag-property _ cell property heightmap)</code><code>(tag-property cell property heightmap)</code></div><div class="doc"><div class="markdown"><p>Set the value of this <code>property</code> of this cell from the corresponding pixel of this <code>heightmap</code>. If the heightmap you supply is smaller than the world, this will break.</p>
<ul>
<li><code>world</code> not actually used, but present to enable this function to be passed as an argument to <code>mw-engine.utils/map-world</code>, q.v.</li>
<li><code>cell</code> a cell, as discussed in world.clj, q.v. Alternatively, a map;</li>
<li><code>property</code> the property (normally a keyword) whose value will be set on the cell.</li>
<li><code>heightmap</code> an (ideally) greyscale image, whose x and y dimensions should exceed those of the world of which the <code>cell</code> forms part.</li>
</ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/heightmap.clj#L35">view source</a></div></div></div></body></html>