From b46adfa65b21b3cab5beee2326336c6f5fe7565d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20=E2=80=98Touky=E2=80=99=20Huet?= Date: Wed, 20 Feb 2013 10:42:37 +0000 Subject: [PATCH] easymesh : Tweak previous crashfix. --- src/easymesh/easymesh.cpp | 8 ++++---- src/easymesh/easymesh.h | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index ed577850..a119a3d6 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -371,10 +371,7 @@ EasyMesh::EasyMesh() bool EasyMesh::Compile(char const *command) { EasyMeshCompiler mc(*this); - bool res = mc.ParseString(command); - delete(m_build_data); - m_build_data = NULL; - return res; + return mc.ParseString(command); } //----------------------------------------------------------------------------- @@ -391,6 +388,9 @@ void EasyMesh::CloseBrace() //----------------------------------------------------------------------------- void EasyMesh::MeshConvert(GpuShaderData* new_gpu_sdata) { + delete(m_build_data); + m_build_data = NULL; + if (new_gpu_sdata) { m_gpu_data.AddGpuData(new_gpu_sdata, this); diff --git a/src/easymesh/easymesh.h b/src/easymesh/easymesh.h index 73277507..733533e4 100644 --- a/src/easymesh/easymesh.h +++ b/src/easymesh/easymesh.h @@ -21,6 +21,22 @@ namespace lol { +//Utility enum for renderers +struct MeshRender +{ + enum Value + { + NeedInit, + CanRender, + IgnoreRender + } + m_value; + + inline MeshRender(Value v) : m_value(v) {} + inline MeshRender() : m_value(NeedInit) {} + inline operator Value() { return m_value; } +}; + //Vertex datas for easymesh vertex list. //TODO : struct VertexData