| 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 | #include <osg/Array> |
|---|
| 28 | #include <osg/Node> |
|---|
| 29 | #include <osg/Texture2D> |
|---|
| 30 | #include <osgDB/ReadFile> |
|---|
| 31 | |
|---|
| 32 | #include "Q3BSPLoad.h" |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | namespace bsp |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | class Q3BSPReader |
|---|
| 40 | { |
|---|
| 41 | public: |
|---|
| 42 | |
|---|
| 43 | Q3BSPReader(); |
|---|
| 44 | |
|---|
| 45 | bool readFile(const std::string& fileName, |
|---|
| 46 | const osgDB::ReaderWriter::Options*); |
|---|
| 47 | |
|---|
| 48 | osg::ref_ptr<osg::Node> getRootNode(); |
|---|
| 49 | |
|---|
| 50 | private: |
|---|
| 51 | |
|---|
| 52 | osg::ref_ptr<osg::Node> root_node; |
|---|
| 53 | |
|---|
| 54 | osg::Geode* convertFromBSP(Q3BSPLoad& aLoadData, |
|---|
| 55 | const osgDB::ReaderWriter::Options*) const; |
|---|
| 56 | |
|---|
| 57 | osg::Geometry* createMeshFace( |
|---|
| 58 | const BSP_LOAD_FACE& aLoadFace, |
|---|
| 59 | const std::vector<osg::Texture2D*>& aTextureArray, |
|---|
| 60 | osg::Vec3Array& aVertexArray, |
|---|
| 61 | std::vector<GLuint>& aIndices, |
|---|
| 62 | osg::Vec2Array& aTextureDecalCoords, |
|---|
| 63 | osg::Vec2Array& aTextureLMapCoords) const; |
|---|
| 64 | |
|---|
| 65 | osg::Geometry* createPolygonFace( |
|---|
| 66 | const BSP_LOAD_FACE& aLoadFace, |
|---|
| 67 | const std::vector<osg::Texture2D*>& aTextureArray, |
|---|
| 68 | const std::vector<osg::Texture2D*>& aTextureLMapArray, |
|---|
| 69 | osg::Vec3Array& aVertexArray, |
|---|
| 70 | osg::Vec2Array& aTextureDecalCoords, |
|---|
| 71 | osg::Vec2Array& aTextureLMapCoords) const; |
|---|
| 72 | |
|---|
| 73 | bool loadTextures( |
|---|
| 74 | const Q3BSPLoad& aLoadData, |
|---|
| 75 | std::vector<osg::Texture2D*>& aTextureArray) const; |
|---|
| 76 | |
|---|
| 77 | bool loadLightMaps( |
|---|
| 78 | const Q3BSPLoad& aLoadData, |
|---|
| 79 | std::vector<osg::Texture2D*>& aTextureArray) const; |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | } |
|---|