Skip to content
Snippets Groups Projects
mapnode.h 5.85 KiB
/*
(c) 2010 Perttu Ahola <celeron55@gmail.com>
*/

#ifndef MAPNODE_HEADER
#define MAPNODE_HEADER

#include <iostream>
#include "common_irrlicht.h"
#include "light.h"
#include "utility.h"
#include "exceptions.h"
#include "serialization.h"

// Size of node in rendering units
#define BS 10

#define MATERIALS_COUNT 256

/*
	Ignored node.

	param is used for custom information in special containers,
	like VoxelManipulator.

	Anything that stores MapNodes doesn't have to preserve parameters
	associated with this material.
	
	Doesn't create faces with anything and is considered being
	out-of-map in the game map.
*/
#define MATERIAL_IGNORE 255
#define MATERIAL_IGNORE_DEFAULT_PARAM 0

/*
	The common material through which the player can walk and which
	is transparent to light
*/
#define MATERIAL_AIR 254

/*
	Materials-todo:

	GRAVEL
	  - Dynamics of gravel: if there is a drop of more than two
	    blocks on any side, it will drop in there. Is this doable?
*/

enum Material
{
	MATERIAL_STONE=0,

	MATERIAL_GRASS,

	/*
		For water, the param is water pressure. 0...127.
		TODO: No, at least the lowest nibble is used for lighting.
		
		- Water will be a bit like light, but with different flow
		  behavior.
		- Water blocks will fall down if there is empty space below.
		- If there is water below, the pressure of the block below is
		  the pressure of the current block + 1, or higher.
		- If there is any pressure in a horizontally neighboring
		  block, a water block will try to move away from it.
		- If there is >=2 of pressure in a block below, water will
		  try to move upwards.
		- NOTE: To keep large operations fast, we have to keep a
		        cache of the water-air-surfaces, just like with light
	*/