00001 /*--License: 00002 Lilith 3D Engine 00003 Copyright Lee Thomason (Grinning Lizard Software) 2002-2004 00004 www.grinninglizard.com/lilith 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 The full text of the license can be found in license.txt 00021 */ 00022 00023 #ifndef L3_WORLD_DEFINE_INCLUDED 00024 #define L3_WORLD_DEFINE_INCLUDED 00025 00026 #include "../grinliz/gldebug.h" 00027 00028 #define SHADOW_VOLUME 00029 00030 namespace lilith3d 00031 { 00032 00043 00044 const unsigned MAP_POWER = 8; 00046 const unsigned MIN_LOD = 3; 00047 00049 const unsigned DEFAULT_MSEC_PER_DAY = 200 * 1000; 00051 const unsigned DEFUALT_MSEC_DAY_START = 5 * DEFAULT_MSEC_PER_DAY / 24; // 5am. 00052 00055 const float FAR_PLANE_DISTANCE = 160.0f; 00056 00060 const float TERRAIN_FADE = FAR_PLANE_DISTANCE * 0.96f; 00061 00063 const float TREE_FADEOUT = FAR_PLANE_DISTANCE * 0.92f; 00065 const float TREE_FADE = FAR_PLANE_DISTANCE * 0.84f; 00066 00068 const float OBJECT_FADEOUT = FAR_PLANE_DISTANCE * 0.70f; 00070 const float OBJECT_FADE = FAR_PLANE_DISTANCE * 0.65f; 00071 00073 const float FOLIAGE_FADEOUT = FAR_PLANE_DISTANCE * 0.60f; 00075 const float FOLIAGE_FADE = FAR_PLANE_DISTANCE * 0.50f; 00076 00077 00078 00080 const float VIEW_ANGLE = 40.0f; 00081 00085 const float WORLD_CEILING = 15.0f; 00086 00088 const float CAMERA_CEILING = 30.0f; 00089 00091 const float TERRAIN_MAX = 10.0f; 00093 const float TERRAIN_MIN = -TERRAIN_MAX; 00094 00096 const float TRANSPARENT_PIXEL = 0.5f; 00097 00108 const float TERRAIN1_START = TERRAIN_MAX * 0.05f; 00109 const float TERRAIN1_OPAQUE = TERRAIN_MAX * 0.15f; 00110 const float TERRAIN2_START = TERRAIN_MAX * 0.65f; 00111 const float TERRAIN2_OPAQUE = TERRAIN_MAX * 0.90f; 00112 00113 const float TERRAIN1_START_SHADER = TERRAIN_MAX * 0.05f; 00114 const float TERRAIN1_OPAQUE_SHADER = TERRAIN_MAX * 0.25f; 00115 const float TERRAIN2_START_SHADER = TERRAIN_MAX * 0.55f; 00116 const float TERRAIN2_OPAQUE_SHADER = TERRAIN_MAX * 0.90f; 00117 00121 const float SHADOW_DIFFUSE = 0.3f; 00122 const float SHADOW_CAST_LENGTH = TERRAIN_MAX * 0.8f; // actual length of the shadow 00123 00124 const float SHADOW_START_FADE = OBJECT_FADE * 0.35f; 00125 const float SHADOW_END_FADE = OBJECT_FADE * 0.40f; 00126 00132 const float TREE_CROSS_START = OBJECT_FADE * 0.20f; 00133 const float TREE_CROSS_END = OBJECT_FADE * 0.30f; 00134 const float TREE_FAR_CROSS = OBJECT_FADE * 0.5f; 00135 00137 const float MAP_TO_METERS = 2.0f; 00138 00140 const int TREE_COVERAGE_DIV = 4; 00141 00143 const float WAVE_HEIGHT = 0.15f; 00145 const float WATER_EMISSIVE = 0.5f; 00147 const float WATER_DIFFUSE = 0.5f; 00148 00149 00151 const float PASSABLE_MIN = -0.3f; 00153 const float DROWN = -0.5f; 00154 00155 00156 // ---------- computed ------------ 00157 const float TERRAIN_HEIGHT = TERRAIN_MAX - TERRAIN_MIN; 00158 const float TERRAIN_FADE_SQUARED = TERRAIN_FADE * TERRAIN_FADE; 00159 const float OBJECT_FADE_SQUARED = OBJECT_FADE * OBJECT_FADE; 00160 const float FAR_PLANE_DISTANCE_SQUARED = FAR_PLANE_DISTANCE * FAR_PLANE_DISTANCE; 00161 const float TREE_CROSS_START_SQUARED = TREE_CROSS_START*TREE_CROSS_START; 00162 const float TREE_CROSS_END_SQUARED = TREE_CROSS_END*TREE_CROSS_END; 00163 const float TREE_FAR_CROSS_SQUARED = TREE_FAR_CROSS * TREE_FAR_CROSS; 00164 const float SHADOW_END_FADE_SQUARED = SHADOW_END_FADE*SHADOW_END_FADE; 00165 const float OBJECT_FADEOUT_SQUARED = OBJECT_FADEOUT * OBJECT_FADEOUT; 00166 const float FOLIAGE_FADEOUT_SQUARED = FOLIAGE_FADEOUT * FOLIAGE_FADEOUT; 00167 00168 const float GRAVITY_MAP = 9.8f / MAP_TO_METERS; 00169 00170 const int MAPSIZE = (int)(1<<MAP_POWER); 00171 const int VERTEXSIZE = (int)(MAPSIZE+1); 00172 00173 const float METERS_TO_MAP = 1.f / MAP_TO_METERS; 00174 00175 const float WATER_ALPHA_START = 0.45f; 00176 const float WATER_OPAQUE_LENGTH = TERRAIN_FADE*0.8f; 00177 00178 // Used as a general max for vertex and index. 00179 const unsigned MAX_VERTEX = 60000; 00180 00181 const int TREE_COUNT = MAPSIZE*MAPSIZE/TREE_COVERAGE_DIV; 00182 const int MAX_TREE_RESOURCE = 8; 00183 const int MAX_FOLIAGE_RESOURCE = 8; 00184 00185 const int MAX_TREE_CACHE = TREE_COUNT / 16; // 8 00186 const int MAX_BB_CACHE = TREE_COUNT / 8; // 4 00187 00188 }; // namespace lilith3d 00189 #endif 00190
1.5.1-p1