File: file.hpp

package info (click to toggle)
openmw 0.49.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,992 kB
  • sloc: cpp: 372,479; xml: 2,149; sh: 1,403; python: 797; makefile: 26
file content (170 lines) | stat: -rw-r--r-- 4,861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#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>

#include <components/files/istreamptr.hpp>

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;
        bool mAlphaBlend;
        std::uint32_t mSourceBlendMode;
        std::uint32_t mDestinationBlendMode;
        std::uint8_t mAlphaTestThreshold;
        bool mAlphaTest;
        bool mDepthWrite, mDepthTest;
        bool mSSR;
        bool mWetnessControlSSR;
        bool mDecal;
        bool mTwoSided;
        bool mDecalNoFade;
        bool mNonOccluder;
        bool mRefraction;
        bool mRefractionFalloff;
        float mRefractionPower;
        bool mEnvMapEnabled;
        float mEnvMapMaskScale;
        bool mDepthBias;
        bool mGrayscaleToPaletteColor;
        std::uint8_t mMaskWrites;

        MaterialFile() = default;
        virtual void read(BGSMStream& stream);
        virtual ~MaterialFile() = default;

        bool wrapT() const { return mClamp & 1; }
        bool wrapS() const { return mClamp & 2; }
    };

    struct BGSMFile : MaterialFile
    {
        std::string mDiffuseMap;
        std::string mNormalMap;
        std::string mSmoothSpecMap;
        std::string mGrayscaleMap;
        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;
        bool mEnableEditorAlphaThreshold;
        bool mTranslucency;
        bool mTranslucencyThickObject;
        bool mTranslucencyMixAlbedoWithSubsurfaceColor;
        osg::Vec3f mTranslucencySubsurfaceColor;
        float mTranslucencyTransmissiveScale;
        float mTranslucencyTurbulence;
        bool mRimLighting;
        float mRimPower;
        float mBackLightPower;
        bool mSubsurfaceLighting;
        float mSubsurfaceLightingRolloff;
        bool mSpecularEnabled;
        osg::Vec3f mSpecularColor;
        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;
        osg::Vec3f mEmittanceColor;
        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;
        bool mGlowMapEnabled;
        bool mEnvMapWindow;
        bool mEnvMapEye;
        bool mHair;
        osg::Vec3f mHairTintColor;
        bool mTree;
        bool mFacegen;
        bool mSkinTint;
        bool mTessellate;
        osg::Vec2f mDisplacementMapParams;
        osg::Vec3f mTessellationParams;
        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;
        osg::Vec3f mBaseColor;
        float mBaseColorScale;
        osg::Vec4f mFalloffParams;
        float mLightingInfluence;
        std::uint8_t mEnvmapMinLOD;
        float mSoftDepth;
        osg::Vec3f mEmittanceColor;
        osg::Vec3f mAdaptiveEmissiveExposureParams;
        bool mGlowMapEnabled;
        bool mEffectPbrSpecular;

        void read(BGSMStream& stream) override;
    };

    using MaterialFilePtr = std::shared_ptr<const Bgsm::MaterialFile>;
    MaterialFilePtr parse(Files::IStreamPtr&& stream);
}
#endif