openmw-tes3coop/components/nif/effect.hpp
Nathan Jeffords 6de6d9ff6e Factored a NIFStream class out of the NIFFile class.
Split NIFFile into two parts, NIFFile which is cached and is a container
for a parsed NIF, and NIFStream which is a class specialized for parsing
NIFs. This required a semi-sweeping change to make all record classes
accept a NIFStream instead of a NIFFile as an agurment to their read
functions.
2013-03-02 09:56:41 -08:00

105 lines
2.2 KiB
C++

/*
OpenMW - The completely unofficial reimplementation of Morrowind
Copyright (C) 2008-2010 Nicolay Korslund
Email: < korslund@gmail.com >
WWW: http://openmw.sourceforge.net/
This file (effect.h) is part of the OpenMW package.
OpenMW is distributed as free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
version 3, 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
version 3 along with this program. If not, see
http://www.gnu.org/licenses/ .
*/
#ifndef _NIF_EFFECT_H_
#define _NIF_EFFECT_H_
#include "node.hpp"
namespace Nif
{
typedef Node Effect;
// Used for NiAmbientLight and NiDirectionalLight. Might also work for
// NiPointLight and NiSpotLight?
struct NiLight : Effect
{
struct SLight
{
float dimmer;
Ogre::Vector3 ambient;
Ogre::Vector3 diffuse;
Ogre::Vector3 specular;
void read(NIFStream *nif)
{
dimmer = nif->getFloat();
ambient = nif->getVector3();
diffuse = nif->getVector3();
specular = nif->getVector3();
}
};
SLight light;
void read(NIFStream *nif)
{
Effect::read(nif);
nif->getInt(); // 1
nif->getInt(); // 1?
light.read(nif);
}
};
struct NiTextureEffect : Effect
{
NiSourceTexturePtr texture;
void read(NIFStream *nif)
{
Effect::read(nif);
int tmp = nif->getInt();
if(tmp) nif->getInt(); // always 1?
/*
3 x Vector4 = [1,0,0,0]
int = 2
int = 0 or 3
int = 2
int = 2
*/
nif->skip(16*4);
texture.read(nif);
/*
byte = 0
vector4 = [1,0,0,0]
short = 0
short = -75
short = 0
*/
nif->skip(23);
}
void post(NIFFile *nif)
{
Effect::post(nif);
texture.post(nif);
}
};
} // Namespace
#endif