Added corners.

master
Robert Zenz 2015-11-03 22:27:58 +01:00
parent 363f1b39fe
commit c44bc60099
10 changed files with 549 additions and 8 deletions

View File

@ -31,9 +31,11 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="modules/worldgenutil.html">worldgenutil</a></li>
<li><a href="modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="modules/corners.rampplacer.html">corners.rampplacer</a></li>
<li><a href="modules/corners.cornerutil.html">corners.cornerutil</a></li>
<li><a href="modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>
@ -44,10 +46,6 @@
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/worldgenutil.html">worldgenutil</a></td>
<td class="summary">Provides various utility functions for generation worlds.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/ramps.rampplacer.html">ramps.rampplacer</a></td>
<td class="summary">RampPlacer is an object that allows to place ramps in the world.</td>
@ -56,6 +54,18 @@
<td class="name" nowrap><a href="modules/ramps.ramputil.html">ramps.ramputil</a></td>
<td class="summary">Utility functions for the creation and registration of ramps.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/corners.rampplacer.html">corners.rampplacer</a></td>
<td class="summary">RampPlacer is an object that allows to place ramps in the world.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/corners.cornerutil.html">corners.cornerutil</a></td>
<td class="summary">Utility functions for the creation and registration of corners.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/worldgenutil.html">worldgenutil</a></td>
<td class="summary">Provides various utility functions for generation worlds.</td>
</tr>
</table>
</div> <!-- id="content" -->

View File

@ -0,0 +1,107 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>ldoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="../modules/corners.rampplacer.html">corners.rampplacer</a></li>
<li><strong>corners.cornerutil</strong></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>corners.cornerutil</code></h1>
<p>Utility functions for the creation and registration of corners.</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#create_corner_nodebox">create_corner_nodebox (detail)</a></td>
<td class="summary">Creates the nodebox for a corner.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "create_corner_nodebox"></a>
<strong>create_corner_nodebox (detail)</strong>
</dt>
<dd>
Creates the nodebox for a corner.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">detail</span>
The level of detail, basically how many steps the corner will
have.
</li>
</ul>
<h3>Returns:</h3>
<ol>
The nodebox for a corner.
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -0,0 +1,341 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>ldoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><strong>corners.rampplacer</strong></li>
<li><a href="../modules/corners.cornerutil.html">corners.cornerutil</a></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>corners.rampplacer</code></h1>
<p>RampPlacer is an object that allows to place ramps in the world.</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#RampPlacer:new">RampPlacer:new ()</a></td>
<td class="summary">Creates a new instance of RampPlacer.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer.mask_value_equals">RampPlacer.mask_value_equals (actual, mask)</a></td>
<td class="summary">Equals function for the mask values.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:is_air">RampPlacer:is_air (node)</a></td>
<td class="summary">Checks if the given node is "air".</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:place_ramp">RampPlacer:place_ramp (x, z, y, manipulator, template, node_info, node_mask, below_air, above_air)</a></td>
<td class="summary">Places a ramp here if possible.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:register_air_like">RampPlacer:register_air_like (node)</a></td>
<td class="summary">Allows to register nodes that are treated like air.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:register_ramp">RampPlacer:register_ramp (node, ramp_node, inner_corner_node, outer_corner_node, floor, ceiling)</a></td>
<td class="summary">Registers a ramp with this RampPlacer.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:run">RampPlacer:run (manipulator, minp, maxp)</a></td>
<td class="summary">Places ramps in the given area.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#RampPlacer:run_on_node">RampPlacer:run_on_node (manipulator, x, z, y)</a></td>
<td class="summary">Places a ramp (or not) on the given location.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "RampPlacer:new"></a>
<strong>RampPlacer:new ()</strong>
</dt>
<dd>
Creates a new instance of RampPlacer.
<h3>Returns:</h3>
<ol>
A new instance of RampPlacer.
</ol>
</dd>
<dt>
<a name = "RampPlacer.mask_value_equals"></a>
<strong>RampPlacer.mask_value_equals (actual, mask)</strong>
</dt>
<dd>
Equals function for the mask values.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">actual</span>
The atual value, generated from the map.
</li>
<li><span class="parameter">mask</span>
The mask value, from the templates.
</li>
</ul>
<h3>Returns:</h3>
<ol>
true if the values equal.
</ol>
</dd>
<dt>
<a name = "RampPlacer:is_air"></a>
<strong>RampPlacer:is_air (node)</strong>
</dt>
<dd>
Checks if the given node is "air".
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
The node to check.
</li>
</ul>
<h3>Returns:</h3>
<ol>
true if the node is air.
</ol>
</dd>
<dt>
<a name = "RampPlacer:place_ramp"></a>
<strong>RampPlacer:place_ramp (x, z, y, manipulator, template, node_info, node_mask, below_air, above_air)</strong>
</dt>
<dd>
Places a ramp here if possible.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">x</span>
The x coordinate.
</li>
<li><span class="parameter">z</span>
The z coordinate.
</li>
<li><span class="parameter">y</span>
The y coordinate.
</li>
<li><span class="parameter">manipulator</span>
The manipulator.
</li>
<li><span class="parameter">template</span>
The ramp template to use.
</li>
<li><span class="parameter">node_info</span>
The node information to use.
</li>
<li><span class="parameter">node_mask</span>
The mask of the node.
</li>
<li><span class="parameter">below_air</span>
If the node is below air.
</li>
<li><span class="parameter">above_air</span>
If the node is above air.
</li>
</ul>
<h3>Returns:</h3>
<ol>
true If a ramp is placed.
</ol>
</dd>
<dt>
<a name = "RampPlacer:register_air_like"></a>
<strong>RampPlacer:register_air_like (node)</strong>
</dt>
<dd>
Allows to register nodes that are treated like air.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
The node to register as air like.
</li>
</ul>
</dd>
<dt>
<a name = "RampPlacer:register_ramp"></a>
<strong>RampPlacer:register_ramp (node, ramp_node, inner_corner_node, outer_corner_node, floor, ceiling)</strong>
</dt>
<dd>
Registers a ramp with this RampPlacer.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
The base node.
</li>
<li><span class="parameter">ramp_node</span>
The ramp node.
</li>
<li><span class="parameter">inner_corner_node</span>
The inner corner node.
</li>
<li><span class="parameter">outer_corner_node</span>
The outer corner node.
</li>
<li><span class="parameter">floor</span>
If ramps should appear on the floor.
</li>
<li><span class="parameter">ceiling</span>
If ramps should appear on the ceiling.
</li>
</ul>
</dd>
<dt>
<a name = "RampPlacer:run"></a>
<strong>RampPlacer:run (manipulator, minp, maxp)</strong>
</dt>
<dd>
Places ramps in the given area.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">manipulator</span>
The MapManipulator to use.
</li>
<li><span class="parameter">minp</span>
The minimum point.
</li>
<li><span class="parameter">maxp</span>
The maximum point.
</li>
</ul>
</dd>
<dt>
<a name = "RampPlacer:run_on_node"></a>
<strong>RampPlacer:run_on_node (manipulator, x, z, y)</strong>
</dt>
<dd>
Places a ramp (or not) on the given location.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">manipulator</span>
The MapManipulator to use.
</li>
<li><span class="parameter">x</span>
The x coordinate.
</li>
<li><span class="parameter">z</span>
The z coordinate.
</li>
<li><span class="parameter">y</span>
The y coordinate.
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -38,9 +38,11 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
<li><strong>ramps.rampplacer</strong></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="../modules/corners.rampplacer.html">corners.rampplacer</a></li>
<li><a href="../modules/corners.cornerutil.html">corners.cornerutil</a></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>

View File

@ -38,9 +38,11 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><strong>ramps.ramputil</strong></li>
<li><a href="../modules/corners.rampplacer.html">corners.rampplacer</a></li>
<li><a href="../modules/corners.cornerutil.html">corners.cornerutil</a></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>

View File

@ -38,9 +38,11 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><strong>worldgenutil</strong></li>
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="../modules/corners.rampplacer.html">corners.rampplacer</a></li>
<li><a href="../modules/corners.cornerutil.html">corners.cornerutil</a></li>
<li><strong>worldgenutil</strong></li>
</ul>
</div>

View File

@ -0,0 +1,50 @@
--[[
Copyright (c) 2015, Robert 'Bobby' Zenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--]]
--- Utility functions for the creation and registration of corners.
cornerutil = {}
--- Creates the nodebox for a corner.
--
-- @param detail The level of detail, basically how many steps the corner will
-- have.
-- @return The nodebox for a corner.
function cornerutil.create_corner_nodebox(detail)
local part = 1 / detail
local nodebox = {}
for step = 0, detail - 1, 1 do
table.insert(nodebox, {
0.5 - part * step, -0.5, part * step - 0.5,
0.5 - part * step - part, 0.5, 0.5
})
end
return nodebox
end

View File

@ -28,6 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
base_path = minetest.get_modpath(minetest.get_current_modname())
dofile(base_path .. "/worldgenutil.lua")
dofile(base_path .. "/corners/cornerutil.lua")
dofile(base_path .. "/ramps/rampplacer.lua")
dofile(base_path .. "/ramps/ramputil.lua")

Binary file not shown.

View File

@ -0,0 +1,26 @@
# Blender v2.69 (sub 0) OBJ File: 'corner.blend'
# www.blender.org
o Cube
v -0.500000 0.500000 -0.500000
v -0.499998 -0.500000 -0.500000
v -0.499998 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
vt -0.000000 1.000000
vt 0.000050 0.000050
vt 1.000000 0.000000
vt 1.000000 1.000000
vt -0.000000 0.000000
vt 1.000050 -0.000050
vn -1.000000 -0.000002 0.000000
vn 0.707107 0.000001 -0.707106
vn 0.000000 -1.000000 0.000000
vn -0.000000 0.000000 1.000000
vn 0.000000 1.000000 -0.000000
s off
f 1/1/1 2/2/1 3/3/1 4/4/1
f 1/4/2 6/1/2 5/5/2 2/3/2
f 3/5/3 2/6/3 5/1/3
f 3/5/4 5/3/4 6/4/4 4/1/4
f 4/1/5 6/5/5 1/4/5