// // Handle and render scene // // Copyright (C) J. Belson 2001.07.15 // // $Author: jon $ : $Date: 2003/06/03 16:46:53 $ // #ifndef _SCENE_H_ #define _SCENE_H_ #include "fcolour.h" #include "matrix.h" #include "point2d.h" #include "point3d.h" #include "render_info.h" #include "types.h" #include "vector2d.h" #include "vector3d.h" class bm_window; class env_map; class hfield; class progress; class renderer; class scene; class settings; class zbuffer; // Pointer to patch handling function typedef void (scene::*patch_func)(const point3d& p1, const point3d& p2, const point3d& p3, const point3d& p4); /** * Set up and render current scene. We use the convention that the * -ve Z axis goes into the screen. */ class scene { private: hfield* land; bool sky; point3d viewpoint; // View position matrix camera; // Camera transformation matrix float threshold; int scene_width, scene_height; int distance; // Details for render target uint32* fbuffer; int bytes_per_row; renderer* rend; zbuffer* zb; progress* prog; // Used for viewing transform float offset_x, offset_y; float scale_x, scale_y; bool use_env; env_map* env; bool show_env_maps; enum { DEFAULT_MAP_WIDTH = 256 + 1, ENV_MAP_SIZE = 320 }; // Rendering options bool textures; bool shadows; bool reflections; bool atmospherics; bool lighting; settings* my_settings; void make_row(point3d* points, int row, float start, float end, float step); // Create a camera matrix for given heading matrix make_camera_matrix(const vector3d& heading); // Display environmental reflection map for debugging purposes void show_env_map(void); public: scene(bm_window* win); ~scene(); void set_land(hfield* hf); void set_sky(bool b); void set_light(const vector3d& v); // Set camera position and view direction void set_view(const point3d& pos, const vector3d heading); // Control various render details void set_textures(bool b); void set_shadows(bool b); void set_reflections(bool b); void set_atmospherics(bool b); void set_detail(int detail); void render(void); }; #endif // _SCENE_H_