OpenMW
|
00001 /* 00002 OpenMW - The completely unofficial reimplementation of Morrowind 00003 Copyright (C) 2008-2010 Nicolay Korslund 00004 Email: < korslund@gmail.com > 00005 WWW: http://openmw.sourceforge.net/ 00006 00007 This file (effect.h) is part of the OpenMW package. 00008 00009 OpenMW is distributed as free software: you can redistribute it 00010 and/or modify it under the terms of the GNU General Public License 00011 version 3, as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 version 3 along with this program. If not, see 00020 http://www.gnu.org/licenses/ . 00021 00022 */ 00023 00024 #ifndef OPENMW_COMPONENTS_NIF_EFFECT_HPP 00025 #define OPENMW_COMPONENTS_NIF_EFFECT_HPP 00026 00027 #include "node.hpp" 00028 00029 namespace Nif 00030 { 00031 00032 typedef Node Effect; 00033 00034 // Used for NiAmbientLight and NiDirectionalLight. Might also work for 00035 // NiPointLight and NiSpotLight? 00036 struct NiLight : Effect 00037 { 00038 struct SLight 00039 { 00040 float dimmer; 00041 Ogre::Vector3 ambient; 00042 Ogre::Vector3 diffuse; 00043 Ogre::Vector3 specular; 00044 00045 void read(NIFStream *nif) 00046 { 00047 dimmer = nif->getFloat(); 00048 ambient = nif->getVector3(); 00049 diffuse = nif->getVector3(); 00050 specular = nif->getVector3(); 00051 } 00052 }; 00053 SLight light; 00054 00055 void read(NIFStream *nif) 00056 { 00057 Effect::read(nif); 00058 00059 nif->getInt(); // 1 00060 nif->getInt(); // 1? 00061 light.read(nif); 00062 } 00063 }; 00064 00065 struct NiTextureEffect : Effect 00066 { 00067 NiSourceTexturePtr texture; 00068 00069 void read(NIFStream *nif) 00070 { 00071 Effect::read(nif); 00072 00073 int tmp = nif->getInt(); 00074 if(tmp) nif->getInt(); // always 1? 00075 00076 /* 00077 3 x Vector4 = [1,0,0,0] 00078 int = 2 00079 int = 0 or 3 00080 int = 2 00081 int = 2 00082 */ 00083 nif->skip(16*4); 00084 00085 texture.read(nif); 00086 00087 /* 00088 byte = 0 00089 vector4 = [1,0,0,0] 00090 short = 0 00091 short = -75 00092 short = 0 00093 */ 00094 nif->skip(23); 00095 } 00096 00097 void post(NIFFile *nif) 00098 { 00099 Effect::post(nif); 00100 texture.post(nif); 00101 } 00102 }; 00103 00104 } // Namespace 00105 #endif