mirror of https://github.com/skeeto/pixelcity.git
Fixed small memory leak and possible "delete NULL".
This commit is contained in:
parent
8a41cecf01
commit
d23e5feac6
6
Mesh.cpp
6
Mesh.cpp
|
@ -36,7 +36,7 @@ CMesh::CMesh ()
|
||||||
_fan_count = 0;
|
_fan_count = 0;
|
||||||
_cube_count = 0;
|
_cube_count = 0;
|
||||||
_polycount = 0;
|
_polycount = 0;
|
||||||
_list = 0;
|
_list = glGenLists(1);
|
||||||
_compiled = false;
|
_compiled = false;
|
||||||
_vertex = NULL;
|
_vertex = NULL;
|
||||||
_normal = NULL;
|
_normal = NULL;
|
||||||
|
@ -66,9 +66,11 @@ CMesh::~CMesh ()
|
||||||
free (_cube);
|
free (_cube);
|
||||||
for (i = 0; i < _quad_strip_count; i++)
|
for (i = 0; i < _quad_strip_count; i++)
|
||||||
delete _quad_strip[i].index_list;
|
delete _quad_strip[i].index_list;
|
||||||
|
if (_quad_strip)
|
||||||
delete _quad_strip;
|
delete _quad_strip;
|
||||||
for (i = 0; i < _fan_count; i++)
|
for (i = 0; i < _fan_count; i++)
|
||||||
delete _fan[i].index_list;
|
delete _fan[i].index_list;
|
||||||
|
if (_fan)
|
||||||
delete _fan;
|
delete _fan;
|
||||||
if (_list)
|
if (_list)
|
||||||
glDeleteLists (_list, 1);
|
glDeleteLists (_list, 1);
|
||||||
|
@ -206,8 +208,6 @@ void CMesh::Render ()
|
||||||
void CMesh::Compile ()
|
void CMesh::Compile ()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!_list)
|
|
||||||
_list = glGenLists(1);
|
|
||||||
glNewList (_list, GL_COMPILE);
|
glNewList (_list, GL_COMPILE);
|
||||||
Render ();
|
Render ();
|
||||||
glEndList();
|
glEndList();
|
||||||
|
|
3
Mesh.h
3
Mesh.h
|
@ -38,9 +38,6 @@ public:
|
||||||
fan* _fan;
|
fan* _fan;
|
||||||
bool _compiled;
|
bool _compiled;
|
||||||
|
|
||||||
//void TriangleRender (unsigned n);
|
|
||||||
//GLtriangle* TriangleAdd (unsigned v1, int unsigned, int unsigned);
|
|
||||||
//GLtriangle* TriangleAdd (GLtriangle c);
|
|
||||||
void NormalAdd (GLvector n);
|
void NormalAdd (GLvector n);
|
||||||
void VertexAdd (GLvertex v);
|
void VertexAdd (GLvertex v);
|
||||||
int VertexCount () { return _vertex_count; }
|
int VertexCount () { return _vertex_count; }
|
||||||
|
|
Loading…
Reference in New Issue