/* Copyright (c) 2002-2012 Croteam Ltd. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ 216 %{ #include "StdH.h" %} uses "EntitiesMP/Marker"; uses "EntitiesMP/FogMarker"; class CHazeMarker: CMarker { name "Haze Marker"; thumbnail "Thumbnails\\HazeMarker.tbn"; features "IsImportant"; properties: 10 enum FogAttenuationType m_faType "Attenuation Type" 'A' =FA_EXP, 11 FLOAT m_fDensity "Density" 'D' = 0.1f, 12 FLOAT m_fNear "Near" = 100.0f, 13 FLOAT m_fFar "Far" = 1000.0f, 14 BOOL m_bVisibleFromOutside "Visible from outside" = FALSE, 22 INDEX m_iSize "Size" = 32, 23 COLOR m_colBase "Base Color" 'C' = (C_WHITE|CT_OPAQUE), 24 COLOR m_colUp "Color (up)" = (C_BLACK|CT_TRANSPARENT), 25 COLOR m_colDown "Color (down)" = (C_BLACK|CT_TRANSPARENT), 26 COLOR m_colNorth "Color (north)" = (C_BLACK|CT_TRANSPARENT), 27 COLOR m_colSouth "Color (south)" = (C_BLACK|CT_TRANSPARENT), 28 COLOR m_colEast "Color (east)" = (C_BLACK|CT_TRANSPARENT), 29 COLOR m_colWest "Color (west)" = (C_BLACK|CT_TRANSPARENT), components: 1 model MODEL_MARKER "Models\\Editor\\Haze.mdl", 2 texture TEXTURE_MARKER "Models\\Editor\\Haze.tex" functions: /* Get haze type name, return empty string if not used. */ const CTString &GetHazeName(void) { return m_strName; } /* Get haze. */ void GetHaze(class CHazeParameters &hpHaze, FLOAT3D &vViewDir) { // calculate directional haze color COLOR colDir=C_BLACK, colMul; FLOAT fR=0.0f, fG=0.0f, fB=0.0f, fA=0.0f; FLOAT fSum = 255.0f / (Abs(vViewDir(1))+Abs(vViewDir(2))+Abs(vViewDir(3))); if( vViewDir(1) < 0.0f) { colMul = (COLOR)(-vViewDir(1)*fSum); colMul = (colMul< 0.0f) { colMul = (COLOR)(+vViewDir(1)*fSum); colMul = (colMul< 0.0f) { colMul = (COLOR)(+vViewDir(2)*fSum); colMul = (colMul< 0.0f) { colMul = (COLOR)(+vViewDir(3)*fSum); colMul = (colMul<=0 && m_fNear