0

Merge remote branch 'origin/master' into JSObserver

This commit is contained in:
Andrew Chin
2012-06-10 14:59:17 -04:00
36 changed files with 1179 additions and 151 deletions

View File

@@ -70,7 +70,7 @@ A more complicated example
renders["survivalnight"] = {
"world": "survival",
"title": "Survival Daytime",
"title": "Survival Nighttime",
"rendermode": smooth_night,
"dimension": "overworld",
}
@@ -461,11 +461,19 @@ values. The valid configuration keys are listed below.
**Default:** ``#1a1a1a``
``base``
Allows you to specify a remote location for the tile folder, useful if you
rsync your map's images to a remote server. Leave a trailing slash and point
to the location that contains the tile folders for each render, not the
tiles folder itself. For example, if the tile images start at
http://domain.com/map/world_day/ you want to set this to http://domain.com/map/
.. _option_texture_pack:
``texturepath``
This is a where a specific texture pack can be found to be used during this render.
It can be either a folder or a directory. Its value should be a string.
It can be either a folder or a zip file containing the texture pack.
Its value should be a string.
.. _crop:
@@ -574,6 +582,14 @@ values. The valid configuration keys are listed below.
**Default:** ``[]`` (an empty list)
.. _option_overlay:
``overlay``
This specifies which renders that this render will be displayed on top of.
It should be a list of other renders.
**Default:** ``[]`` (an empty list)
``showspawn``
This is a boolean, and defaults to ``True``. If set to ``False``, then the spawn
icon will not be displayed on the rendered map.
@@ -628,6 +644,13 @@ Nether
HeightFading
Draws a colored overlay on the blocks that fades them out according to their
height.
**Options**
sealevel
sealevel of the word you're rendering. Note that the default,
128, is usually *incorrect* for most worlds. You should
probably set this to 64. Default: 128
Depth
Only renders blocks between the specified min and max heights.
@@ -640,6 +663,17 @@ Depth
max
highest level of blocks to render. Default: 255
Exposed
Only renders blocks that are exposed (adjacent to a transparent block).
**Options**
mode
when set to 1, inverts the render mode, only drawing unexposed blocks. Default: 0
NoFluids
Don't render fluid blocks (water, lava).
EdgeLines
Draw edge lines on the back side of blocks, to help distinguish them from
the background.
@@ -658,6 +692,15 @@ Cave
only_lit
Only render lit caves. Default: False
Hide
Hide blocks based on blockid. Blocks hidden in this way will be
treated exactly the same as air.
**Options**
minerals
A list of block ids, or (blockid, data) tuples to hide.
DepthTinting
Tint blocks a color according to their depth (height) from bedrock. Useful
mainly for cave renders.
@@ -687,16 +730,16 @@ ClearBase
Forces the background to be transparent. Use this in place of Base
for rendering pure overlays.
.. warning::
Overlays are currently not functional in this branch of code. We are
working on them. Please inquire in :ref:`IRC<help>` for more information.
SpawnOverlay
Color the map red in areas where monsters can spawn. Either use
this on top of other modes, or on top of ClearBase to create a
pure overlay.
SlimeOverlay
Color the map green in chunks where slimes can spawn. Either use
this on top of other modes, or on top of ClearBase to create a
pure overlay.
MineralOverlay
Color the map according to what minerals can be found
underneath. Either use this on top of other modes, or on top of

View File

@@ -17,7 +17,7 @@ So let's get started!
.. note::
This page is still under construction
This page is continually under construction
.. contents::
@@ -82,7 +82,7 @@ pre-rendered sprite (a small image). The basic idea is to iterate over the
blocks of the world and draw these sprites to the appropriate location on the
map.
These are the high-level tasks The Overviewer must preform in rendering a map:
These are the high-level tasks The Overviewer must perform in rendering a map:
1. Render each block sprite from the textures
2. Scan the chunks of the world and determine which tiles need rendering
@@ -143,7 +143,7 @@ transformations can be chained together simply by multiplying the transformation
matrices together, only one transformation is actually done.
This can be seen in the function
:func:`overviewer_core.textures.transform_image`. It preforms three steps:
:func:`overviewer_core.textures.transform_image`. It performs three steps:
1. The texture is re-sized to 17 by 17 pixels. This is done because the diagonal
of a square with sides 17 is approximately 24, which is the target size for

View File

@@ -246,7 +246,7 @@ If you want or need to provide your own textures, you have several options:
overviewer.exe.
* Specify any terrain.png or texture pack you want with the
:ref:`texture_pack<option_texture_pack>` option.
:ref:`texturepath<option_texturepath>` option.
If you copy your world before you render it
-------------------------------------------

View File

@@ -20,51 +20,100 @@ Filter Functions
----------------
A filter function is a python function that is used to figure out if a given POI
should be part of a markerSet of not. The function should accept one argument
(a dictionary, also know as an associative array), and return a boolean::
should be part of a markerSet of not, and to control how it is displayed.
The function should accept one argument (a dictionary, also know as an associative
array), and return a string representing the text to be displayed. For example::
def signFilter(poi):
"All signs"
return poi['id'] == 'Sign'
if poi['id'] == 'Sign':
return "\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']])
If a POI doesn't match, the filter can return None (which is the default if a python
functions runs off the end without an explicit 'return').
The single argument will either a TileEntity, or an Entity taken directly from
the chunk file. In this example, this function returns true only if the type
of entity is a sign. For more information of TileEntities and Entities, see
the chunk file. It could also be a special entity representing a player's location
or a player's spawn. See below for more details.
In this example, this function returns all 4 lines from the sign
if the entity is a sign.
For more information of TileEntities and Entities, see
the `Chunk Format <http://www.minecraftwiki.net/wiki/Chunk_format>`_ page on
the Minecraft Wiki.
.. note::
The doc string ("All signs" in this example) is important. It is the label
that appears in your rendered map
A more complicated filter function can construct a more customized display text::
A more advanced filter may also look at other entity fields, such as the sign text::
def chestFilter(poi):
if poi['id'] == "Chest":
return "Chest with %d items" % len(poi['Items'])
def goldFilter(poi):
"Gold"
return poi['id'] == 'Sign' and (\
'gold' in poi['Text1'] or
'gold' in poi['Text2'])
This looks for the word 'gold' in either the first or second line of the signtext.
Since writing these filters can be a little tedious, a set of predefined filters
functions are provided. See the :ref:`predefined_filter_functions` section for
details.
Special POIs
------------
There are currently two special types of POIs. They each have a special id:
PlayerSpawn
Used to indicate the spawn location of a player. The player's name is set
in the ``EntityId`` key, and the location is in the x,y,z keys
Player
Used to indicate the last known location of a player. The player's name is set
in the ``EntityId`` key, and the location is in the x,y,z keys.
.. note::
The player location is taken from level.dat (in the case of a single-player world)
or the player.dat files (in the case of a multi-player server). The locations are
only written to these files when the world is saved, so this won't give you real-time
player location information.
Here's an example that displays icons for each player::
def playerIcons(poi):
if poi['id'] == 'Player':
poi['icon'] = "http://overviewer.org/avatar/%s" % poi['EntityId']
return "Last known location for %s" % poi['EntityId']
Note how each POI can get a different icon by setting ``poi['icon']``
Render Dictionary Key
---------------------
Each render can specify a list of zero or more filter functions. Each of these
filter functions become a selectable item in the 'Signs' drop-down menu in the
rendered map. For example::
rendered map. Previously, this used to be a list of functions. Now it is a list
of dictionaries. For example::
renders['myrender'] = {
'world': 'myworld',
'title': "Example",
'markers': [allFilter, anotherFilter],
'markers': [dict(name="All signs", filterFunction=signFilter),
dict(name="Chests", filterFunction=chestFilter, icon="chest.png", createInfoWindow=False)]
}
The following keys are accepted in the marker dictionary:
``name``
This is the text that is displayed in the 'Signs' dropdown.
``filterFunction``
This is the filter function. It must accept at least 1 argument (the POI to filter),
and it must return either None or a string.
``icon``
Optional. Specifies the icon to use for POIs in this group. If omitted, it defaults
to a signpost icon. Note that each POI can have different icon by setting the key 'icon'
on the POI itself (this can be done by modifying the POI in the filter function. See the
example above)
``createInfoWindow``
Optional. Specifies whether or not the icon displays an info window on click. Defaults to True
Generating the POI Markers