| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | /******************************/ |
|---|
| 23 | /*** CaLight World (Header) ***/ |
|---|
| 24 | /******************************/ |
|---|
| 25 | |
|---|
| 26 | #ifndef CAFU_CALIGHTWORLD_HPP_INCLUDED |
|---|
| 27 | #define CAFU_CALIGHTWORLD_HPP_INCLUDED |
|---|
| 28 | |
|---|
| 29 | #include "../Common/World.hpp" |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | class CaLightWorldT |
|---|
| 33 | { |
|---|
| 34 | public: |
|---|
| 35 | |
|---|
| 36 | CaLightWorldT(const char* FileName, ModelManagerT& ModelMan); |
|---|
| 37 | |
|---|
| 38 | const cf::SceneGraph::BspTreeNodeT& GetBspTree() const { return *World.BspTree; } |
|---|
| 39 | const ArrayT<PointLightT>& GetPointLights() const { return World.PointLights; } |
|---|
| 40 | |
|---|
| 41 | double TraceRay(const Vector3dT& Start, const Vector3dT& Ray) const; |
|---|
| 42 | |
|---|
| 43 | /// Creates (fake) lightmaps for (brush or bezier patch based) entities. |
|---|
| 44 | /// The generated lightmaps are only "fakes", i.e. they are not a result of the true Radiosity computations of CaLight. |
|---|
| 45 | /// Instead, they are obtained by sampling the environment (the world entity) and interpolating the obtained values. |
|---|
| 46 | /// This of course is only possible after the world has been lit by the true Radiosity process. |
|---|
| 47 | /// While the disadvantages are clear (objects that have not participated in the original Radiosity computations can |
|---|
| 48 | /// obviously not blend into the environment visually as smoothly as if they had been there right from the start), |
|---|
| 49 | /// the advantages are a reasonably quick completion of the computations and independency of the internal data of the |
|---|
| 50 | /// original Radiosity computations. |
|---|
| 51 | /// For example, this function can be implemented without reference to the "bins" of the tone-mapping operator of the |
|---|
| 52 | /// world, which in turn makes the implementation of the "-onlyEnts" command-line option primally possible. |
|---|
| 53 | void CreateLightMapsForEnts(); |
|---|
| 54 | |
|---|
| 55 | // Forwarded functions. |
|---|
| 56 | void SaveToDisk(const char* FileName) const; |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | private: |
|---|
| 60 | |
|---|
| 61 | WorldT World; |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | #endif |
|---|