OpenMW
components/nif/controlled.hpp
Go to the documentation of this file.
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 (controlled.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_CONTROLLED_HPP
00025 #define OPENMW_COMPONENTS_NIF_CONTROLLED_HPP
00026 
00027 #include "extra.hpp"
00028 #include "controller.hpp"
00029 
00030 namespace Nif
00031 {
00032 
00034 class Controlled : public Extra
00035 {
00036 public:
00037     ControllerPtr controller;
00038 
00039     void read(NIFStream *nif)
00040     {
00041         Extra::read(nif);
00042         controller.read(nif);
00043     }
00044 
00045     void post(NIFFile *nif)
00046     {
00047         Extra::post(nif);
00048         controller.post(nif);
00049     }
00050 };
00051 
00053 class Named : public Controlled
00054 {
00055 public:
00056     std::string name;
00057 
00058     void read(NIFStream *nif)
00059     {
00060         name = nif->getString();
00061         Controlled::read(nif);
00062     }
00063 };
00064 typedef Named NiSequenceStreamHelper;
00065 
00066 class NiParticleGrowFade : public Controlled
00067 {
00068 public:
00069     float growTime;
00070     float fadeTime;
00071 
00072     void read(NIFStream *nif)
00073     {
00074         Controlled::read(nif);
00075         growTime = nif->getFloat();
00076         fadeTime = nif->getFloat();
00077     }
00078 };
00079 
00080 class NiParticleColorModifier : public Controlled
00081 {
00082 public:
00083     NiColorDataPtr data;
00084 
00085     void read(NIFStream *nif)
00086     {
00087         Controlled::read(nif);
00088         data.read(nif);
00089     }
00090 
00091     void post(NIFFile *nif)
00092     {
00093         Controlled::post(nif);
00094         data.post(nif);
00095     }
00096 };
00097 
00098 class NiGravity : public Controlled
00099 {
00100 public:
00101     float mForce;
00102     /* 0 - Wind (fixed direction)
00103      * 1 - Point (fixed origin)
00104      */
00105     int mType;
00106     Ogre::Vector3 mPosition;
00107     Ogre::Vector3 mDirection;
00108 
00109     void read(NIFStream *nif)
00110     {
00111         Controlled::read(nif);
00112 
00113         /*unknown*/nif->getFloat();
00114         mForce = nif->getFloat();
00115         mType = nif->getUInt();
00116         mPosition = nif->getVector3();
00117         mDirection = nif->getVector3();
00118     }
00119 };
00120 
00121 // NiPinaColada
00122 class NiPlanarCollider : public Controlled
00123 {
00124 public:
00125     void read(NIFStream *nif)
00126     {
00127         Controlled::read(nif);
00128 
00129         // (I think) 4 floats + 4 vectors
00130         nif->skip(4*16);
00131     }
00132 };
00133 
00134 class NiParticleRotation : public Controlled
00135 {
00136 public:
00137     void read(NIFStream *nif)
00138     {
00139         Controlled::read(nif);
00140 
00141         /*
00142            byte (0 or 1)
00143            float (1)
00144            float*3
00145         */
00146         nif->skip(17);
00147     }
00148 };
00149 
00150 } // Namespace
00151 #endif