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
|
diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp
--- libgltf.org/src/LoadScene.cpp 2014-06-13 01:13:40.654653289 +0200
+++ libgltf/src/LoadScene.cpp 2014-06-13 01:15:45.034648018 +0200
@@ -148,10 +148,14 @@
return true;
}
-int Parser::parseScene(Scene* pscene)
+void Parser::setScene(Scene* pscene)
+{
+ pScene = pscene;
+}
+
+int Parser::parseScene()
{
int status;
- this->pScene = pscene;
{
TRACE_TIME ("parseScene->readBuffers", CPU);
diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h
--- libgltf.org/src/LoadScene.h 2014-06-13 01:13:40.654653289 +0200
+++ libgltf/src/LoadScene.h 2014-06-13 01:16:03.886647220 +0200
@@ -27,7 +27,8 @@
public:
glTFHandle* getFileNameInJson(const std::string& jsonFile);
bool releaseFileName();
- int parseScene(Scene* pscene);
+ void setScene(Scene* pscene);
+ int parseScene();
bool parseJsonFile();
void setJsonInfo(const std::string& sbuffer);
void setJsonInfo(const std::string& direct, const std::string& fileName);
@@ -81,4 +82,4 @@
bool is_json_in_buffer;
};
-#endif
\ No newline at end of file
+#endif
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
--- libgltf.org/src/RenderScene.cpp 2014-06-13 01:13:40.654653289 +0200
+++ libgltf/src/RenderScene.cpp 2014-06-13 01:15:11.222649451 +0200
@@ -561,7 +561,7 @@
{
return LIBGLTF_PARSE_JSON_ERROR;
}
- int iStatus = mLoadJson.parseScene(&scene);
+ int iStatus = mLoadJson.parseScene();
if (iStatus != LIBGLTF_SUCESS)
{
return iStatus;
@@ -571,12 +571,11 @@
int RenderScene::loadScene(Scene& scene, glTFHandle* handle)
{
- scene.setGltfHandle(handle);
try
{
{
TRACE_TIME ("loadScene->parseScene", CPU);
- int iStatus = mLoadJson.parseScene(&scene);
+ int iStatus = mLoadJson.parseScene();
if (iStatus != LIBGLTF_SUCESS)
{
return iStatus;
@@ -612,7 +611,11 @@
}
}
string tmpFileName(jsonfile->filename);
- return mLoadJson.getFileNameInJson(tmpFileName);
+ glTFHandle* handle = mLoadJson.getFileNameInJson(tmpFileName);
+ pScene = new Scene();
+ pScene->setGltfHandle(handle);
+ mLoadJson.setScene(pScene);
+ return handle;
}
unsigned int RenderScene::bindAttribute(const Attribute* pAttr)
@@ -844,11 +847,6 @@
int RenderScene::initRender(glTFHandle* handle)
{
- pScene = new Scene();
- if(0 == pScene)
- {
- return LIBGLTF_MEMORY_ERROR;
- }
int iResult = loadScene(*pScene, handle);
if( iResult != LIBGLTF_SUCESS)
{
@@ -1543,4 +1541,4 @@
int RenderScene::isAnimPlay()
{
return this->mAnimationPlay ? 1 : 0;
-}
\ No newline at end of file
+}
|