|
Revision 11107, 1.6 kB
(checked in by mplatings, 3 years ago)
|
|
|
| Rev | Line | |
|---|
| [11107] | 1 | #ifndef FBXMATERIALTOOSGSTATESET_H |
|---|
| 2 | #define FBXMATERIALTOOSGSTATESET_H |
|---|
| 3 | |
|---|
| 4 | #include <map> |
|---|
| 5 | #include <memory> |
|---|
| 6 | #include <osg/Material> |
|---|
| 7 | #include <osg/StateSet> |
|---|
| 8 | #include <osgDB/Options> |
|---|
| 9 | #include <osg/Texture2D> |
|---|
| 10 | |
|---|
| 11 | #if defined(_MSC_VER) |
|---|
| 12 | #pragma warning( disable : 4505 ) |
|---|
| 13 | #endif |
|---|
| 14 | #include <fbxsdk.h> |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | typedef std::pair<osg::Material *, osg::Texture2D *> StateSetContent; |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | typedef std::map<const KFbxSurfaceMaterial *, StateSetContent> KFbxMaterialMap; |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | typedef std::map<std::string, osg::Texture2D *> ImageMap; |
|---|
| 25 | |
|---|
| 26 | class FbxMaterialToOsgStateSet |
|---|
| 27 | { |
|---|
| 28 | public: |
|---|
| 29 | |
|---|
| 30 | StateSetContent convert(const KFbxSurfaceMaterial* pFbxMat); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | FbxMaterialToOsgStateSet::FbxMaterialToOsgStateSet(const std::string& dir, const osgDB::Options* options) : |
|---|
| 34 | _options(options), |
|---|
| 35 | _dir(dir) {} |
|---|
| 36 | private: |
|---|
| 37 | |
|---|
| 38 | osg::ref_ptr<osg::Texture2D> |
|---|
| 39 | fbxTextureToOsgTexture(const KFbxTexture* pOsgTex); |
|---|
| 40 | KFbxMaterialMap _kFbxMaterialMap; |
|---|
| 41 | ImageMap _imageMap; |
|---|
| 42 | const osgDB::Options* _options; |
|---|
| 43 | const std::string _dir; |
|---|
| 44 | }; |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | #endif //FBXMATERIALTOOSGSTATESET_H |
|---|