2010-01-07 18:52:11 +00:00
|
|
|
/*
|
|
|
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
|
|
|
Copyright (C) 2008-2010 Nicolay Korslund
|
|
|
|
Email: < korslund@gmail.com >
|
2018-03-08 20:23:24 +00:00
|
|
|
WWW: https://openmw.org/
|
2010-01-07 18:52:11 +00:00
|
|
|
|
|
|
|
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
|
2018-03-08 20:23:24 +00:00
|
|
|
https://www.gnu.org/licenses/ .
|
2010-01-07 18:52:11 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-02-24 21:51:56 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIF_EFFECT_HPP
|
|
|
|
#define OPENMW_COMPONENTS_NIF_EFFECT_HPP
|
2010-01-07 18:52:11 +00:00
|
|
|
|
2010-06-03 18:44:55 +00:00
|
|
|
#include "node.hpp"
|
2010-01-07 18:52:11 +00:00
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
2015-11-12 22:27:34 +00:00
|
|
|
struct NiDynamicEffect : public Node
|
2010-01-07 18:52:11 +00:00
|
|
|
{
|
2020-10-16 18:18:54 +00:00
|
|
|
void read(NIFStream *nif) override
|
2012-07-03 04:41:21 +00:00
|
|
|
{
|
2015-11-12 22:27:34 +00:00
|
|
|
Node::read(nif);
|
2020-10-03 22:27:49 +00:00
|
|
|
if (nif->getVersion() >= nif->generateVersion(10,1,0,106)
|
|
|
|
&& nif->getBethVersion() < NIFFile::BethVersion::BETHVER_FO4)
|
|
|
|
nif->getBoolean(); // Switch state
|
2015-11-12 22:27:34 +00:00
|
|
|
unsigned int numAffectedNodes = nif->getUInt();
|
|
|
|
for (unsigned int i=0; i<numAffectedNodes; ++i)
|
|
|
|
nif->getUInt(); // ref to another Node
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Used as base for NiAmbientLight, NiDirectionalLight, NiPointLight and NiSpotLight.
|
|
|
|
struct NiLight : NiDynamicEffect
|
|
|
|
{
|
|
|
|
float dimmer;
|
|
|
|
osg::Vec3f ambient;
|
|
|
|
osg::Vec3f diffuse;
|
|
|
|
osg::Vec3f specular;
|
2012-07-10 07:27:13 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void read(NIFStream *nif) override;
|
2015-11-12 22:27:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NiPointLight : public NiLight
|
|
|
|
{
|
|
|
|
float constantAttenuation;
|
|
|
|
float linearAttenuation;
|
|
|
|
float quadraticAttenuation;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void read(NIFStream *nif) override;
|
2010-01-07 18:52:11 +00:00
|
|
|
};
|
|
|
|
|
2015-11-12 22:45:12 +00:00
|
|
|
struct NiSpotLight : public NiPointLight
|
|
|
|
{
|
|
|
|
float cutoff;
|
|
|
|
float exponent;
|
2020-10-16 18:18:54 +00:00
|
|
|
void read(NIFStream *nif) override;
|
2015-11-12 22:45:12 +00:00
|
|
|
};
|
|
|
|
|
2015-11-12 22:27:34 +00:00
|
|
|
struct NiTextureEffect : NiDynamicEffect
|
2010-01-07 18:52:11 +00:00
|
|
|
{
|
2012-07-03 04:41:21 +00:00
|
|
|
NiSourceTexturePtr texture;
|
2016-02-24 20:06:41 +00:00
|
|
|
unsigned int clamp;
|
|
|
|
|
|
|
|
enum TextureType
|
|
|
|
{
|
|
|
|
Projected_Light = 0,
|
|
|
|
Projected_Shadow = 1,
|
|
|
|
Environment_Map = 2,
|
|
|
|
Fog_Map = 3
|
|
|
|
};
|
|
|
|
TextureType textureType;
|
|
|
|
|
|
|
|
enum CoordGenType
|
|
|
|
{
|
|
|
|
World_Parallel = 0,
|
|
|
|
World_Perspective,
|
|
|
|
Sphere_Map,
|
|
|
|
Specular_Cube_Map,
|
|
|
|
Diffuse_Cube_Map
|
|
|
|
};
|
|
|
|
CoordGenType coordGenType;
|
2012-07-03 04:41:21 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void read(NIFStream *nif) override;
|
|
|
|
void post(NIFFile *nif) override;
|
2010-01-07 18:52:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Namespace
|
|
|
|
#endif
|