Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

landscape_c Class Reference

Terrain object. More...

#include <landscape.h>


Public Methods

void deinit ()
 deinitialize

void create (ulong width, ulong height)
 create empty terrain

void create_from_texture (sshort tex)
 create terrain from texture

void create_from_raw (uchar *raw, ulong width, ulong height)
 create terrain from raw hf

void create_from_image (image_c *img)
 create terrain from image

void circles (ulong iter)
 make hills using circles algo

void erode (float power)
 erode hills

void normalize ()
 normalize heights (0.0-1.0)

void create_normals ()
 create node normals

void prelight ()
 prelight terrain

void set_height (ulong x, ulong y, float value)
 set height of terrain node

void set_uv (ulong x, ulong y, ushort corner, float u, float v)
 set texture coords for node

void tile_shader (shader_t *_shader)
 tile a shader onto terrain

void stretch_shader (shader_t *_shader)
 strech a shader over terrain

void set_shader (shader_t *_shader, ulong x, ulong y, bool setuv)
 set the shader for a node

void set_scale (const vec3_t _scale)
 set scales

float get_height (float x, float y)
 get the height for a position

void get_slope (float x, float y, vec2_t out)
 get slope for position

bool is_node_visible (ulong x, ulong y)
 get visibility of node

vec3_c get_scale ()
 get scale

ulong get_drawn_tile_count ()
 get drawn tile count


Protected Attributes

ulong height
 size of terrain

vec3_c scale
 scaling factors

vec3_c pos
 position to draw terrain

array_c< struct shader_s > * shaders
 list of shaders

bool init
 init was successful

ulong drawntiles
 number of drawn tiles

node_snodes
 nodes


Detailed Description

This is a terrain.

Todo:
void createfromimage(image_c *img);

Definition at line 69 of file landscape.h.


Member Function Documentation

void create ulong    width,
ulong    height
 

Parameters:
_width  width of the landscape
_height  height

Definition at line 88 of file r_landscape.cpp.

void create_from_image image_c   img
 

Parameters:
img  image to use

Definition at line 161 of file r_landscape.cpp.

void create_from_raw uchar *    raw,
ulong    width,
ulong    height
 

Parameters:
raw  pointer to an unsigned char array
width  x dimension of array
height  and y

Definition at line 197 of file r_landscape.cpp.

void create_from_texture sshort    tex
 

Parameters:
tex  texture index to use

Definition at line 138 of file r_landscape.cpp.

References SafeDelete.

void prelight  
 

This function uses the lights in gv.lights[] to apply lighting to the terrain. The lights' position is interpreted as a directionial vector where the light is coming from.

Definition at line 227 of file r_landscape.cpp.

References vec4_c::clear(), color_from_floats(), color_to_vec(), vertex_s::diffuse, vec3_c::dot(), height, vec4_c::ma(), nodes, vec3_c::normalize(), vec4_t, and node_s::verts.


The documentation for this class was generated from the following files:
Generated on Wed Dec 18 15:48:49 2002 for omicron engine by doxygen1.2.18