0

setup.py now auto-discovers available render primitives

This commit is contained in:
Aaron Griffith
2012-01-08 00:52:30 -05:00
parent a682b8a689
commit 7cacc59428
4 changed files with 70 additions and 58 deletions

View File

@@ -19,29 +19,13 @@
#include <string.h>
#include <stdarg.h>
extern RenderPrimitiveInterface primitive_base;
extern RenderPrimitiveInterface primitive_nether;
extern RenderPrimitiveInterface primitive_height_fading;
extern RenderPrimitiveInterface primitive_depth;
extern RenderPrimitiveInterface primitive_edge_lines;
/* list of all render primitives, ending in NULL
/* this file defines render_primitives,
a list of all render primitives, ending in NULL
all of these will be available to the user, so DON'T include primitives
that are only useful as a base for other primitives. */
static RenderPrimitiveInterface *render_primitives[] = {
&primitive_base,
&primitive_nether,
&primitive_height_fading,
&primitive_depth,
&primitive_edge_lines,
//&rendermode_lighting,
//&rendermode_smooth_lighting,
//&rendermode_cave,
//&rendermode_spawn,
//&rendermode_mineral,
NULL
};
that are only useful as a base for other primitives.
this file is auto-generated by setup.py */
#include "primitives.h"
/* rendermode encapsulation */

View File

@@ -15,15 +15,27 @@
* with the Overviewer. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* To make a new render primitive (the C part, at least):
/* To make a new render primitive:
*
* * add a data struct and extern'd interface declaration below
* * add a new class to rendermodes.py
* there are a ton of examples there, the syntax is pretty simple. If
* you need any extra objects that are easy to create in python, this
* is where you put them.
*
* * fill in this interface struct in primitives/(yourmode).c
* (see primitives/base.c for an example: the "base" primitive)
* * create a file in src/primitives with the same name
* so, Nether (named "nether") goes in `nether.c`.
*
* * add your primitive to the list in rendermodes.c
* * declare a RenderPrimitiveInterface with the name primitive_name
* if you have an underscore in the name, replace it with a
* hyphen. height-fading uses primitive_height_fading.
*
* * fill in the entries of this struct
* the name should match, and you should declare an 'instance' struct
* to use as the self argument to each function. See nether.c and
* height-fading.c for simple examples.
*
* setup.py will pick up your primitive, add it to the global list, and build
* it for you if you follow these conventions.
*/
#ifndef __RENDERMODES_H_INCLUDED__