00001 /* 00002 toxic - A Global Illumination Renderer 00003 Copyright (C) 2003-2004 Francois Beaune 00004 Contact: http://toxicengine.sourceforge.net/ 00005 00006 This file is part of toxic. 00007 00008 toxic is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 toxic is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with toxic; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef TOXIC_RENDERER_SETTINGS_H 00024 #define TOXIC_RENDERER_SETTINGS_H 00025 00026 #include "common/math/real.h" 00027 #include "globals.h" 00028 00029 namespace toxic { 00030 00031 //! All settings come from the scene settings file. 00032 //! The Renderer class is the only class that accesses this settings. 00033 class Settings { 00034 public: 00035 struct SamplingSettings { 00036 enum Algorithm { 00037 RANDOM_SAMPLING, 00038 REGULAR_SAMPLING, 00039 STRATIFIED_SAMPLING 00040 } m_algorithm; 00041 00042 //! Random sampling settings. 00043 struct RandomSampling { 00044 int m_samples; //!< Number of samples. 00045 bool IsConsistent() const; 00046 } m_random_sampling; 00047 00048 //! Regular sampling settings. 00049 struct RegularSampling { 00050 int m_width, m_height; //!< Grid size (number of samples is m_width * m_height). 00051 bool IsConsistent() const; 00052 } m_regular_sampling; 00053 00054 //! Stratified sampling settings. 00055 struct StratifiedSampling { 00056 int m_width, m_height; //!< Grid size (number of samples is m_width * m_height). 00057 bool IsConsistent() const; 00058 } m_stratified_sampling; 00059 00060 bool IsConsistent() const; 00061 }; 00062 00063 struct RadianceEstimateSettings { 00064 int m_max_photons; //!< Maximum number of photons in the radiance estimate. 00065 sheep::Real m_max_distance; //!< Maximum search distance in the radiance estimate. 00066 bool IsConsistent() const; 00067 }; 00068 00069 //! <Rendering> 00070 struct Rendering { 00071 //! <PixelSampling> 00072 struct PixelSampling { 00073 enum Algorithm { 00074 SUPERSAMPLING, 00075 WHITTED_ADAPTIVE_SAMPLING 00076 } m_algorithm; 00077 00078 //! <Supersampling> 00079 struct Supersampling : public SamplingSettings { 00080 } m_supersampling; 00081 00082 //! <WhittedAdaptiveSampling> 00083 struct WhittedAdaptiveSampling { 00084 sheep::Real m_contrast_threshold; //!< Contrast threshold to decide when to subdivide further. 00085 int m_max_depth; //!< Maximum recursion level. 00086 bool IsConsistent() const; 00087 } m_whitted_adaptive_sampling; 00088 00089 bool IsConsistent() const; 00090 } m_pixel_sampling; 00091 00092 //! <Components> 00093 struct Components { 00094 //! <DirectLighting> 00095 struct DirectLighting { 00096 bool m_enabled; //!< Include direct lighting? 00097 00098 //! <ArealightSampling> 00099 struct ArealightSampling : public SamplingSettings { 00100 } m_arealight_sampling; 00101 00102 bool IsConsistent() const; 00103 } m_direct_lighting; 00104 00105 //! <IndirectLighting> 00106 struct IndirectLighting { 00107 bool m_enabled; //!< Include indirect lighting? 00108 00109 //! <PhotonTracing> 00110 struct PhotonTracing { 00111 int m_photons; //!< Number of indirect lighting photons to emit. 00112 bool IsConsistent() const; 00113 } m_photon_tracing; 00114 00115 //! <RadiancePrecomputation> 00116 struct RadiancePrecomp { 00117 bool m_enabled; //!< Precompute radiance estimates? 00118 int m_spacing; //!< Spacing between precomputed samples. 00119 sheep::Real m_max_search_dist; //!< Maximum distance to search for a photon carrying a precomputed radiance estimate. 00120 bool IsConsistent() const; 00121 } m_radiance_precomp; 00122 00123 //! <RadianceEstimate> 00124 struct RadianceEstimate : public RadianceEstimateSettings { 00125 } m_radiance_est; 00126 00127 //! <PrimaryFinalGathering> 00128 struct PrimaryFinalGathering : public SamplingSettings { 00129 bool m_enabled; //!< Is primary final gathering enabled? 00130 bool IsConsistent() const; 00131 } m_primary_fg; 00132 00133 //! <SecondaryFinalGathering> 00134 struct SecondaryFinalGathering : public SamplingSettings { 00135 bool m_enabled; //!< Is secondary final gathering enabled? 00136 sheep::Real m_distance_threshold; //!< Distance threshold under which a secondary final gathering is triggered. 00137 bool IsConsistent() const; 00138 } m_secondary_fg; 00139 00140 bool IsConsistent() const; 00141 } m_indirect_lighting; 00142 00143 //! <SpecularReflections> 00144 struct SpecularReflections { 00145 bool m_enabled; //!< Include specular reflections? 00146 int m_max_depth; //!< Maximum recursion level. 00147 bool IsConsistent() const; 00148 } m_specular_reflections; 00149 00150 //! <Caustics> 00151 struct Caustics { 00152 bool m_enabled; //!< Include caustics? 00153 00154 //! <PhotonTracing> 00155 struct PhotonTracing { 00156 int m_photons; //!< Number of caustics photons to emit. 00157 bool IsConsistent() const; 00158 } m_photon_tracing; 00159 00160 //! <RadianceEstimate> 00161 struct RadianceEstimate : public RadianceEstimateSettings { 00162 } m_radiance_est; 00163 00164 bool IsConsistent() const; 00165 } m_caustics; 00166 00167 bool IsConsistent() const; 00168 } m_components; 00169 00170 bool IsConsistent() const; 00171 } m_rendering; 00172 00173 //! <Output> 00174 struct Output { 00175 //! <RenderArea> 00176 struct RenderArea { 00177 bool m_enabled; //!< Restrict render area? If disabled, render the whole image. 00178 int m_x0, m_y0, m_x1, m_y1; //!< Render area bounds. 00179 bool IsConsistent() const; 00180 } m_render_area; 00181 00182 //! <GammaCorrection> 00183 struct GammaCorrection { 00184 bool m_enabled; //!< Perform gamma correction? 00185 sheep::Real m_target_gamma; //!< Target gamma. 00186 bool IsConsistent() const; 00187 } m_gamma_correction; 00188 00189 bool IsConsistent() const; 00190 } m_output; 00191 00192 bool IsConsistent() const; 00193 }; 00194 00195 #include "settings.inl" 00196 00197 } 00198 00199 #endif // !TOXIC_RENDERER_SETTINGS_H
1.3.6