~openmw/openmw/openmw-packaging2

« back to all changes in this revision

Viewing changes to components/nif/property.hpp

  • Committer: Scott Howard
  • Date: 2015-11-27 08:01:08 UTC
  • Revision ID: showard@debian.org-20151127080108-vby93jqgdvxj8d6d
Cron update. Git hash: 37c8fea

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
{
34
34
public:
35
35
    // The meaning of these depends on the actual property type.
36
 
    int flags;
 
36
    unsigned int flags;
37
37
 
38
 
    void read(NIFStream *nif)
39
 
    {
40
 
        Named::read(nif);
41
 
        flags = nif->getUShort();
42
 
    }
 
38
    void read(NIFStream *nif);
43
39
};
44
40
 
45
41
class NiTexturingProperty : public Property
67
63
        int clamp, uvSet, filter;
68
64
        short unknown2;
69
65
 
70
 
        void read(NIFStream *nif)
71
 
        {
72
 
            inUse = !!nif->getInt();
73
 
            if(!inUse) return;
74
 
 
75
 
            texture.read(nif);
76
 
            clamp = nif->getInt();
77
 
            filter = nif->getInt();
78
 
            uvSet = nif->getInt();
79
 
 
80
 
            // I have no idea, but I think these are actually two
81
 
            // PS2-specific shorts (ps2L and ps2K), followed by an unknown
82
 
            // short.
83
 
            nif->skip(6);
84
 
        }
85
 
 
86
 
        void post(NIFFile *nif)
87
 
        {
88
 
            texture.post(nif);
89
 
        }
 
66
        void read(NIFStream *nif);
 
67
        void post(NIFFile *nif);
90
68
    };
91
69
 
92
70
    /* Apply mode:
117
95
        GlossTexture = 3,
118
96
        GlowTexture = 4,
119
97
        BumpTexture = 5,
120
 
        DecalTexture = 6
 
98
        DecalTexture = 6,
 
99
        NumTextures = 7 // Sentry value
121
100
    };
122
101
 
123
102
    Texture textures[7];
124
103
 
125
 
    void read(NIFStream *nif)
126
 
    {
127
 
        Property::read(nif);
128
 
        apply = nif->getInt();
129
 
 
130
 
        // Unknown, always 7. Probably the number of textures to read
131
 
        // below
132
 
        nif->getInt();
133
 
 
134
 
        textures[0].read(nif); // Base
135
 
        textures[1].read(nif); // Dark
136
 
        textures[2].read(nif); // Detail
137
 
        textures[3].read(nif); // Gloss (never present)
138
 
        textures[4].read(nif); // Glow
139
 
        textures[5].read(nif); // Bump map
140
 
        if(textures[5].inUse)
141
 
        {
142
 
            // Ignore these at the moment
143
 
            /*float lumaScale =*/ nif->getFloat();
144
 
            /*float lumaOffset =*/ nif->getFloat();
145
 
            /*const Vector4 *lumaMatrix =*/ nif->getVector4();
146
 
        }
147
 
        textures[6].read(nif); // Decal
148
 
    }
149
 
 
150
 
    void post(NIFFile *nif)
151
 
    {
152
 
        Property::post(nif);
153
 
        for(int i = 0;i < 7;i++)
154
 
            textures[i].post(nif);
155
 
    }
 
104
    void read(NIFStream *nif);
 
105
    void post(NIFFile *nif);
156
106
};
157
107
 
158
108
class NiFogProperty : public Property
159
109
{
160
110
public:
161
111
    float mFogDepth;
162
 
    Ogre::Vector3 mColour;
163
 
 
164
 
 
165
 
    void read(NIFStream *nif)
166
 
    {
167
 
        Property::read(nif);
168
 
 
169
 
        mFogDepth = nif->getFloat();
170
 
        mColour = nif->getVector3();
171
 
    }
 
112
    osg::Vec3f mColour;
 
113
 
 
114
    void read(NIFStream *nif);
172
115
};
173
116
 
174
117
// These contain no other data than the 'flags' field in Property
194
137
struct S_MaterialProperty
195
138
{
196
139
    // The vector components are R,G,B
197
 
    Ogre::Vector3 ambient, diffuse, specular, emissive;
 
140
    osg::Vec3f ambient, diffuse, specular, emissive;
198
141
    float glossiness, alpha;
199
142
 
200
 
    void read(NIFStream *nif)
201
 
    {
202
 
        ambient = nif->getVector3();
203
 
        diffuse = nif->getVector3();
204
 
        specular = nif->getVector3();
205
 
        emissive = nif->getVector3();
206
 
        glossiness = nif->getFloat();
207
 
        alpha = nif->getFloat();
208
 
    }
 
143
    void read(NIFStream *nif);
209
144
};
210
145
 
211
146
struct S_VertexColorProperty
221
156
    */
222
157
    int vertmode, lightmode;
223
158
 
224
 
    void read(NIFStream *nif)
225
 
    {
226
 
        vertmode = nif->getInt();
227
 
        lightmode = nif->getInt();
228
 
    }
 
159
    void read(NIFStream *nif);
229
160
};
230
161
 
231
162
struct S_AlphaProperty
265
196
 
266
197
        Taken from:
267
198
        http://niftools.sourceforge.net/doc/nif/NiAlphaProperty.html
268
 
 
269
 
        Right now we only use standard alpha blending (see the Ogre code
270
 
        that sets it up) and it appears that this is the only blending
271
 
        used in the original game. Bloodmoon (along with several mods) do
272
 
        however use other settings, such as discarding pixel values with
273
 
        alpha < 1.0. This is faster because we don't have to mess with the
274
 
        depth stuff like we did for blending. And OGRE has settings for
275
 
        this too.
276
199
    */
277
200
 
278
201
    // Tested against when certain flags are set (see above.)
279
202
    unsigned char threshold;
280
203
 
281
 
    void read(NIFStream *nif)
282
 
    {
283
 
        threshold = nif->getChar();
284
 
    }
 
204
    void read(NIFStream *nif);
285
205
};
286
206
 
287
207
/*
301
221
        4   TEST_GREATER
302
222
        5   TEST_NOT_EQUAL
303
223
        6   TEST_GREATER_EQUAL
304
 
        7   TEST_ALWAYS
 
224
        7   TEST_NEVER (though nifskope comment says TEST_ALWAYS, but ingame it is TEST_NEVER)
305
225
     */
306
226
    int compareFunc;
307
227
    unsigned stencilRef;
327
247
     */
328
248
    int drawMode;
329
249
 
330
 
    void read(NIFStream *nif)
331
 
    {
332
 
        enabled = nif->getChar();
333
 
        compareFunc = nif->getInt();
334
 
        stencilRef = nif->getUInt();
335
 
        stencilMask = nif->getUInt();
336
 
        failAction = nif->getInt();
337
 
        zFailAction = nif->getInt();
338
 
        zPassAction = nif->getInt();
339
 
        drawMode = nif->getInt();
340
 
    }
 
250
    void read(NIFStream *nif);
341
251
};
342
252
 
343
253
class NiAlphaProperty : public StructPropT<S_AlphaProperty> { };