File: GLTFExtraDataHandler.h

package info (click to toggle)
collada2gltf 20140924-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,688 kB
  • sloc: cpp: 33,763; ansic: 5,313; python: 29; makefile: 6
file content (61 lines) | stat: -rw-r--r-- 1,648 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
/*
*/

#ifndef __GLTF_EXTRADATAHANDLER_H__
#define __GLTF_EXTRADATAHANDLER_H__

#include "COLLADASaxFWLIExtraDataCallbackHandler.h"

#if (defined(WIN32) || defined(_LIBCPP_VERSION) || __cplusplus > 199711L)
#include <memory>
#include <unordered_map>
#else
#include <tr1/memory>
#include <tr1/unordered_map>
#endif

namespace GLTF
{
    class JSONObject;
    
	class ExtraDataHandler : public COLLADASaxFWL::IExtraDataCallbackHandler
	{
	private:
		enum ExtraTagType
		{
			EXTRA_TAG_TYPE_UNKNOWN = 0,
			EXTRA_TAG_TYPE_DOUBLE_SIDED,
            EXTRA_TAG_TYPE_LOCK_AMBIENT_DIFFUSE,
			EXTRA_TAG_TYPE_BUMP
		};

	private:
        std::string mTextBuffer;
		ExtraTagType mExtraTagType;
		COLLADAFW::UniqueId mCurrentElementUniqueId;
		COLLADAFW::Object* mCurrentObject;

	public:
		ExtraDataHandler();
		~ExtraDataHandler();
		bool elementBegin( const COLLADASaxFWL::ParserChar* elementName, const GeneratedSaxParser::xmlChar** attributes);

		bool elementEnd(const COLLADASaxFWL::ParserChar* elementName );
		bool textData(const COLLADASaxFWL::ParserChar* text, size_t textLength);

		bool parseElement( const COLLADASaxFWL::ParserChar* profileName, const COLLADASaxFWL::StringHash& elementHash
			, const COLLADAFW::UniqueId& uniqueId, COLLADAFW::Object* object );
        
        std::shared_ptr <JSONObject> getExtras(COLLADAFW::UniqueId uniqueId);
        std::shared_ptr <JSONObject> allExtras() { return this->_allExtras; }
        
        void determineBumpTextureSamplerAndTexCoord( const GeneratedSaxParser::xmlChar** attributes );

	private:
        std::shared_ptr <JSONObject> _allExtras;
	};
}


#endif //__GLTF_EXTRADATAHANDLER_H__