Fixed crash in fbx import pipeline
This commit is contained in:
@@ -110,6 +110,8 @@ KRMesh::~KRMesh() {
|
||||
}
|
||||
|
||||
void KRMesh::releaseData() {
|
||||
m_hasTransparency = false;
|
||||
m_submeshes.clear();
|
||||
if(m_pIndexBaseData) {
|
||||
m_pIndexBaseData->unlock();
|
||||
delete m_pIndexBaseData;
|
||||
@@ -397,7 +399,7 @@ void KRMesh::renderSubmesh(int iSubmesh, KRNode::RenderPass renderPass, const st
|
||||
|
||||
void KRMesh::LoadData(const KRMesh::mesh_info &mi, bool calculate_normals, bool calculate_tangents) {
|
||||
|
||||
clearBuffers();
|
||||
releaseData();
|
||||
|
||||
// TODO, FINDME - These values should be passed as a parameter and set by GUI flags
|
||||
bool use_short_vertexes = false;
|
||||
@@ -645,10 +647,6 @@ KRVector3 KRMesh::getMaxPoint() const {
|
||||
return m_maxPoint;
|
||||
}
|
||||
|
||||
void KRMesh::clearBuffers() {
|
||||
m_submeshes.clear();
|
||||
}
|
||||
|
||||
int KRMesh::getLODCoverage() const {
|
||||
return m_lodCoverage;
|
||||
}
|
||||
|
||||
@@ -250,9 +250,6 @@ private:
|
||||
int m_vertex_size;
|
||||
void updateAttributeOffsets();
|
||||
|
||||
|
||||
void clearBuffers();
|
||||
|
||||
void setName(const std::string name);
|
||||
|
||||
|
||||
|
||||
@@ -45,11 +45,14 @@ public:
|
||||
KRMeshStreamer(KRContext &context);
|
||||
~KRMeshStreamer();
|
||||
|
||||
void startStreamer();
|
||||
|
||||
private:
|
||||
KRContext &m_context;
|
||||
|
||||
std::thread m_thread;
|
||||
std::atomic<bool> m_stop;
|
||||
std::atomic<bool> m_running;
|
||||
|
||||
void run();
|
||||
};
|
||||
|
||||
@@ -28,6 +28,14 @@ NSOpenGLContext *gMeshStreamerContext = nil;
|
||||
|
||||
KRMeshStreamer::KRMeshStreamer(KRContext &context) : m_context(context)
|
||||
{
|
||||
m_running = false;
|
||||
m_stop = false;
|
||||
}
|
||||
|
||||
void KRMeshStreamer::startStreamer()
|
||||
{
|
||||
if(!m_running) {
|
||||
m_running = true;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
gMeshStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup];
|
||||
@@ -43,14 +51,17 @@ KRMeshStreamer::KRMeshStreamer(KRContext &context) : m_context(context)
|
||||
#error Unsupported Platform
|
||||
#endif
|
||||
|
||||
m_stop = false;
|
||||
m_thread = std::thread(&KRMeshStreamer::run, this);
|
||||
}
|
||||
}
|
||||
|
||||
KRMeshStreamer::~KRMeshStreamer()
|
||||
{
|
||||
if(m_running) {
|
||||
m_stop = true;
|
||||
m_thread.join();
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
[gMeshStreamerContext release];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ private:
|
||||
std::atomic<bool> m_running;
|
||||
|
||||
void run();
|
||||
|
||||
};
|
||||
|
||||
#endif /* defined(KRTEXTURESTREAMER_H) */
|
||||
|
||||
@@ -27,7 +27,6 @@ NSOpenGLContext *gTextureStreamerContext = nil;
|
||||
#error Unsupported Platform
|
||||
#endif
|
||||
|
||||
|
||||
KRTextureStreamer::KRTextureStreamer(KRContext &context) : m_context(context)
|
||||
{
|
||||
m_running = false;
|
||||
@@ -65,8 +64,11 @@ void KRTextureStreamer::startStreamer()
|
||||
|
||||
KRTextureStreamer::~KRTextureStreamer()
|
||||
{
|
||||
if(m_running) {
|
||||
m_stop = true;
|
||||
m_thread.join();
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
[gTextureStreamerContext release];
|
||||
}
|
||||
@@ -92,6 +94,4 @@ void KRTextureStreamer::run()
|
||||
}
|
||||
std::this_thread::sleep_for( sleep_duration );
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user