1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00
OpenMW/components/bgsm/file.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

168 lines
4.7 KiB
C++
Raw Normal View History

2024-04-17 19:53:55 +00:00
#ifndef OPENMW_COMPONENTS_BGSM_FILE_HPP
#define OPENMW_COMPONENTS_BGSM_FILE_HPP
#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
#include <osg/Vec2f>
#include <osg/Vec3f>
#include <osg/Vec4f>
namespace Bgsm
{
class BGSMStream;
enum class ShaderType
{
Lighting,
Effect,
};
struct MaterialFile
{
ShaderType mShaderType;
std::uint32_t mVersion;
std::uint32_t mClamp;
osg::Vec2f mUVOffset, mUVScale;
float mTransparency;
2024-04-17 22:51:31 +00:00
bool mAlphaBlend;
std::uint32_t mSourceBlendMode;
2024-04-17 19:53:55 +00:00
std::uint32_t mDestinationBlendMode;
2024-04-17 22:51:31 +00:00
std::uint8_t mAlphaTestThreshold;
2024-04-17 19:53:55 +00:00
bool mAlphaTest;
bool mDepthWrite, mDepthTest;
bool mSSR;
bool mWetnessControlSSR;
bool mDecal;
bool mTwoSided;
bool mDecalNoFade;
bool mNonOccluder;
bool mRefraction;
bool mRefractionFalloff;
float mRefractionPower;
2024-04-18 00:27:42 +00:00
bool mEnvMapEnabled;
2024-04-17 19:53:55 +00:00
float mEnvMapMaskScale;
bool mDepthBias;
bool mGrayscaleToPaletteColor;
std::uint8_t mMaskWrites;
MaterialFile() = default;
virtual void read(BGSMStream& stream);
2024-04-20 15:48:12 +00:00
virtual ~MaterialFile() = default;
bool wrapT() const { return mClamp & 1; }
bool wrapS() const { return mClamp & 2; }
2024-04-17 19:53:55 +00:00
};
struct BGSMFile : MaterialFile
{
std::string mDiffuseMap;
std::string mNormalMap;
std::string mSmoothSpecMap;
2024-04-18 00:27:42 +00:00
std::string mGrayscaleMap;
2024-04-17 19:53:55 +00:00
std::string mGlowMap;
std::string mWrinkleMap;
std::string mSpecularMap;
std::string mLightingMap;
std::string mFlowMap;
std::string mDistanceFieldAlphaMap;
std::string mEnvMap;
std::string mInnerLayerMap;
std::string mDisplacementMap;
2024-04-17 23:28:48 +00:00
bool mEnableEditorAlphaThreshold;
2024-04-17 19:53:55 +00:00
bool mTranslucency;
bool mTranslucencyThickObject;
bool mTranslucencyMixAlbedoWithSubsurfaceColor;
2024-04-17 23:33:30 +00:00
osg::Vec3f mTranslucencySubsurfaceColor;
2024-04-17 19:53:55 +00:00
float mTranslucencyTransmissiveScale;
float mTranslucencyTurbulence;
bool mRimLighting;
float mRimPower;
float mBackLightPower;
2024-04-17 23:28:48 +00:00
bool mSubsurfaceLighting;
2024-04-17 19:53:55 +00:00
float mSubsurfaceLightingRolloff;
bool mSpecularEnabled;
2024-04-17 23:33:30 +00:00
osg::Vec3f mSpecularColor;
2024-04-17 19:53:55 +00:00
float mSpecularMult;
float mSmoothness;
float mFresnelPower;
float mWetnessControlSpecScale;
float mWetnessControlSpecPowerScale;
float mWetnessControlSpecMinvar;
float mWetnessControlEnvMapScale;
float mWetnessControlFresnelPower;
float mWetnessControlMetalness;
bool mPBR;
bool mCustomPorosity;
float mPorosityValue;
std::string mRootMaterialPath;
bool mAnisoLighting;
bool mEmitEnabled;
2024-04-17 23:33:30 +00:00
osg::Vec3f mEmittanceColor;
2024-04-17 19:53:55 +00:00
float mEmittanceMult;
bool mModelSpaceNormals;
bool mExternalEmittance;
float mLumEmittance;
bool mUseAdaptiveEmissive;
osg::Vec3f mAdaptiveEmissiveExposureParams;
bool mBackLighting;
bool mReceiveShadows;
bool mHideSecret;
bool mCastShadows;
bool mDissolveFade;
bool mAssumeShadowmask;
2024-04-18 00:27:42 +00:00
bool mGlowMapEnabled;
2024-04-17 19:53:55 +00:00
bool mEnvMapWindow;
bool mEnvMapEye;
bool mHair;
2024-04-17 23:33:30 +00:00
osg::Vec3f mHairTintColor;
2024-04-17 19:53:55 +00:00
bool mTree;
bool mFacegen;
bool mSkinTint;
bool mTessellate;
osg::Vec2f mDisplacementMapParams;
2024-04-17 23:28:48 +00:00
osg::Vec3f mTessellationParams;
2024-04-17 19:53:55 +00:00
float mGrayscaleToPaletteScale;
bool mSkewSpecularAlpha;
bool mTerrain;
osg::Vec3f mTerrainParams;
void read(BGSMStream& stream) override;
};
struct BGEMFile : MaterialFile
{
std::string mBaseMap;
std::string mGrayscaleMap;
std::string mEnvMap;
std::string mNormalMap;
std::string mEnvMapMask;
std::string mSpecularMap;
std::string mLightingMap;
std::string mGlowMap;
bool mBlood;
bool mEffectLighting;
bool mFalloff;
bool mFalloffColor;
bool mGrayscaleToPaletteAlpha;
bool mSoft;
2024-04-17 23:33:30 +00:00
osg::Vec3f mBaseColor;
2024-04-17 19:53:55 +00:00
float mBaseColorScale;
osg::Vec4f mFalloffParams;
float mLightingInfluence;
std::uint8_t mEnvmapMinLOD;
float mSoftDepth;
2024-04-17 23:33:30 +00:00
osg::Vec3f mEmittanceColor;
2024-04-17 19:53:55 +00:00
osg::Vec3f mAdaptiveEmissiveExposureParams;
2024-04-18 00:27:42 +00:00
bool mGlowMapEnabled;
2024-04-17 19:53:55 +00:00
bool mEffectPbrSpecular;
void read(BGSMStream& stream) override;
};
using MaterialFilePtr = std::shared_ptr<const Bgsm::MaterialFile>;
}
#endif