2010-01-07 19:52:11 +01:00
|
|
|
/*
|
|
|
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
|
|
|
Copyright (C) 2008-2010 Nicolay Korslund
|
|
|
|
Email: < korslund@gmail.com >
|
2018-03-08 21:23:24 +01:00
|
|
|
WWW: https://openmw.org/
|
2010-01-07 19:52:11 +01: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 21:23:24 +01:00
|
|
|
https://www.gnu.org/licenses/ .
|
2010-01-07 19:52:11 +01:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-02-24 13:51:56 -08:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIF_EFFECT_HPP
|
|
|
|
#define OPENMW_COMPONENTS_NIF_EFFECT_HPP
|
2010-01-07 19:52:11 +01:00
|
|
|
|
2010-06-03 20:44:55 +02:00
|
|
|
#include "node.hpp"
|
2010-01-07 19:52:11 +01:00
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
2023-08-31 22:05:55 +03:00
|
|
|
// Abstract
|
2023-09-10 05:23:25 +03:00
|
|
|
struct NiDynamicEffect : public NiAVObject
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
bool mSwitchState{ true };
|
2022-09-22 21:26:05 +03:00
|
|
|
void read(NIFStream* nif) override;
|
|
|
|
};
|
2015-11-12 23:27:34 +01:00
|
|
|
|
2023-08-31 22:05:55 +03:00
|
|
|
// Abstract light source
|
2022-09-22 21:26:05 +03:00
|
|
|
struct NiLight : NiDynamicEffect
|
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
float mDimmer;
|
|
|
|
osg::Vec3f mAmbient;
|
|
|
|
osg::Vec3f mDiffuse;
|
|
|
|
osg::Vec3f mSpecular;
|
2012-07-02 21:41:21 -07:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
void read(NIFStream* nif) override;
|
|
|
|
};
|
2010-01-07 19:52:11 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
struct NiPointLight : public NiLight
|
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
float mConstantAttenuation;
|
|
|
|
float mLinearAttenuation;
|
|
|
|
float mQuadraticAttenuation;
|
2015-11-12 23:45:12 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
void read(NIFStream* nif) override;
|
|
|
|
};
|
2016-02-24 21:06:41 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
struct NiSpotLight : public NiPointLight
|
2016-02-24 21:06:41 +01:00
|
|
|
{
|
2023-11-08 12:27:12 +03:00
|
|
|
float mOuterSpotAngle;
|
|
|
|
float mInnerSpotAngle{ 0.f };
|
2023-08-31 22:05:55 +03:00
|
|
|
float mExponent;
|
2022-09-22 21:26:05 +03:00
|
|
|
void read(NIFStream* nif) override;
|
2016-02-24 21:06:41 +01:00
|
|
|
};
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
struct NiTextureEffect : NiDynamicEffect
|
2016-02-24 21:06:41 +01:00
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
enum class TextureType : uint32_t
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
ProjectedLight = 0,
|
|
|
|
ProjectedShadow = 1,
|
|
|
|
EnvironmentMap = 2,
|
|
|
|
FogMap = 3,
|
2022-09-22 21:26:05 +03:00
|
|
|
};
|
|
|
|
|
2023-08-31 22:05:55 +03:00
|
|
|
enum class CoordGenType : uint32_t
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2023-08-31 22:05:55 +03:00
|
|
|
WorldParallel = 0,
|
|
|
|
WorldPerspective = 1,
|
|
|
|
SphereMap = 2,
|
|
|
|
SpecularCubeMap = 3,
|
|
|
|
DiffuseCubeMap = 4,
|
2022-09-22 21:26:05 +03:00
|
|
|
};
|
2023-08-31 22:05:55 +03:00
|
|
|
|
|
|
|
Matrix3 mProjectionRotation;
|
|
|
|
osg::Vec3f mProjectionPosition;
|
|
|
|
uint32_t mFilterMode;
|
|
|
|
NiSourceTexturePtr mTexture;
|
|
|
|
uint16_t mMaxAnisotropy{ 0 };
|
|
|
|
uint32_t mClampMode;
|
|
|
|
TextureType mTextureType;
|
|
|
|
CoordGenType mCoordGenType;
|
|
|
|
uint8_t mEnableClipPlane;
|
|
|
|
osg::Plane mClipPlane;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
|
|
|
void read(NIFStream* nif) override;
|
2022-09-17 19:24:42 +02:00
|
|
|
void post(Reader& nif) override;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2023-08-31 22:05:55 +03:00
|
|
|
bool wrapT() const { return mClampMode & 1; }
|
|
|
|
bool wrapS() const { return mClampMode & 2; }
|
2016-02-24 21:06:41 +01:00
|
|
|
};
|
2010-01-07 19:52:11 +01:00
|
|
|
|
|
|
|
} // Namespace
|
|
|
|
#endif
|