File: Wm5VisualEffect.h

package info (click to toggle)
libwildmagic 5.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 89,572 kB
  • ctags: 26,264
  • sloc: cpp: 210,924; csh: 637; sh: 95; makefile: 36
file content (101 lines) | stat: -rw-r--r-- 3,839 bytes parent folder | download | duplicates (3)
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
// Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.2 (2012/07/01)

#ifndef WM5VISUALEFFECT_H
#define WM5VISUALEFFECT_H

#include "Wm5GraphicsLIB.h"
#include "Wm5FileIO.h"
#include "Wm5VisualTechnique.h"

namespace Wm5
{

class WM5_GRAPHICS_ITEM VisualEffect : public Object
{
    WM5_DECLARE_RTTI;
    WM5_DECLARE_NAMES;
    WM5_DECLARE_STREAM(VisualEffect);

public:
    // Construction and destruction.
    VisualEffect ();
    virtual ~VisualEffect ();

    // Support for deferred construction.  The function appends the new
    // technique to the end of the array.
    void InsertTechnique (VisualTechnique* technique);

    // Member access.
    inline int GetNumTechniques () const;
    VisualTechnique* GetTechnique (int techniqueIndex) const;

    // Access to components of the effect.
    int GetNumPasses (int techniqueIndex) const;
    VisualPass* GetPass (int techniqueIndex, int passIndex) const;
    VertexShader* GetVertexShader (int techniqueIndex, int passIndex) const;
    PixelShader* GetPixelShader (int techniqueIndex, int passIndex) const;
    AlphaState* GetAlphaState (int techniqueIndex, int passIndex) const;
    CullState* GetCullState (int techniqueIndex, int passIndex) const;
    DepthState* GetDepthState (int techniqueIndex, int passIndex) const;
    OffsetState* GetOffsetState (int techniqueIndex, int passIndex) const;
    StencilState* GetStencilState (int techniqueIndex, int passIndex) const;
    WireState* GetWireState (int techniqueIndex, int passIndex) const;

protected:
    std::vector<VisualTechniquePtr> mTechniques;

// Support for the raw load/save of VisualEffect.
public:
    // Load/save a visual effect from/to a *.wmfx file outside the
    // streaming system.
    static VisualEffect* LoadWMFX (const std::string& name,
        int mode = FileIO::FM_DEFAULT_READ);

    void SaveWMFX (const std::string& name,
        int mode = FileIO::FM_DEFAULT_WRITE);

protected:
    // For derived classes to load the effect from a *.wmfx file.
    VisualEffect (const std::string& name,
        int mode = FileIO::FM_DEFAULT_READ);

private:
    static VisualTechnique* LoadVisualTechnique (FileIO& inFile);
    static VisualPass* LoadVisualPass (FileIO& inFile);
    static Shader* LoadShader (FileIO& inFile, bool isVertexShader);
    static AlphaState* LoadAlphaState (FileIO& inFile);
    static CullState* LoadCullState (FileIO& inFile);
    static DepthState* LoadDepthState (FileIO& inFile);
    static OffsetState* LoadOffsetState (FileIO& inFile);
    static StencilState* LoadStencilState (FileIO& inFile);
    static WireState* LoadWireState (FileIO& inFile);
    static std::string LoadStdString (FileIO& inFile);

    static void SaveVisualTechnique (FileIO& outFile,
        VisualTechnique* technique);
    static void SaveVisualPass (FileIO& outFile, VisualPass* pass);
    static void SaveShader (FileIO& outFile, Shader* shader);
    static void SaveAlphaState (FileIO& outFile, AlphaState* astate);
    static void SaveCullState (FileIO& outFile, CullState* cstate);
    static void SaveDepthState (FileIO& outFile, DepthState* dstate);
    static void SaveOffsetState (FileIO& outFile, OffsetState* ostate);
    static void SaveStencilState (FileIO& outFile, StencilState* sstate);
    static void SaveWireState (FileIO& outFile, WireState* wstate);
    static void SaveStdString (FileIO& outFile, std::string& name);

// End support for raw load/save.
};

WM5_REGISTER_STREAM(VisualEffect);
typedef Pointer0<VisualEffect> VisualEffectPtr;
#include "Wm5VisualEffect.inl"

}

#endif