mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:41:02 +02:00
makes things run and build on OSX and fixes missing initialization in loader
This commit is contained in:
parent
5bb55f7fc4
commit
5350de1c76
1 changed files with 27 additions and 16 deletions
|
@ -310,7 +310,7 @@ namespace
|
||||||
|
|
||||||
class Loader : UrlReader
|
class Loader : UrlReader
|
||||||
{
|
{
|
||||||
InputVertices& ref_vertices;
|
InputVertices* ptr_vertices;
|
||||||
unsigned val_limit;
|
unsigned val_limit;
|
||||||
|
|
||||||
unsigned val_lineno;
|
unsigned val_lineno;
|
||||||
|
@ -323,7 +323,7 @@ namespace
|
||||||
bool loadVertices(
|
bool loadVertices(
|
||||||
InputVertices& destination, char const* url, unsigned limit)
|
InputVertices& destination, char const* url, unsigned limit)
|
||||||
{
|
{
|
||||||
ref_vertices = destination;
|
ptr_vertices = & destination;
|
||||||
val_limit = limit;
|
val_limit = limit;
|
||||||
str_actual_url = url; // in case we fail early
|
str_actual_url = url; // in case we fail early
|
||||||
|
|
||||||
|
@ -347,8 +347,10 @@ namespace
|
||||||
val_lineno = 0u;
|
val_lineno = 0u;
|
||||||
str_actual_url = url; // new value in http redirect
|
str_actual_url = url; // new value in http redirect
|
||||||
|
|
||||||
ref_vertices.clear();
|
val_records_read = 0u;
|
||||||
ref_vertices.reserve(val_limit);
|
|
||||||
|
ptr_vertices->clear();
|
||||||
|
ptr_vertices->reserve(val_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t transfer(char* input, size_t bytes)
|
size_t transfer(char* input, size_t bytes)
|
||||||
|
@ -383,35 +385,35 @@ namespace
|
||||||
if (val_records_read++ == val_limit)
|
if (val_records_read++ == val_limit)
|
||||||
{
|
{
|
||||||
std::make_heap(
|
std::make_heap(
|
||||||
ref_vertices.begin(), ref_vertices.end(),
|
ptr_vertices->begin(), ptr_vertices->end(),
|
||||||
GreaterBrightness() );
|
GreaterBrightness() );
|
||||||
|
|
||||||
val_min_brightness = getBrightness(
|
val_min_brightness = getBrightness(
|
||||||
ref_vertices.begin()->getColor() );
|
ptr_vertices->begin()->getColor() );
|
||||||
}
|
}
|
||||||
if (ref_vertices.size() == val_limit)
|
if (ptr_vertices->size() == val_limit)
|
||||||
{
|
{
|
||||||
if (val_min_brightness >= getBrightness(c))
|
if (val_min_brightness >= getBrightness(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::pop_heap(
|
std::pop_heap(
|
||||||
ref_vertices.begin(), ref_vertices.end(),
|
ptr_vertices->begin(), ptr_vertices->end(),
|
||||||
GreaterBrightness() );
|
GreaterBrightness() );
|
||||||
ref_vertices.pop_back();
|
ptr_vertices->pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ref_vertices.push_back( InputVertex(azi, alt, c) );
|
ptr_vertices->push_back( InputVertex(azi, alt, c) );
|
||||||
|
|
||||||
if (val_limit > 0 && val_records_read > val_limit)
|
if (val_limit > 0 && val_records_read > val_limit)
|
||||||
{
|
{
|
||||||
std::push_heap(
|
std::push_heap(
|
||||||
ref_vertices.begin(), ref_vertices.end(),
|
ptr_vertices->begin(), ptr_vertices->end(),
|
||||||
GreaterBrightness() );
|
GreaterBrightness() );
|
||||||
ref_vertices.pop_back();
|
ptr_vertices->pop_back();
|
||||||
|
|
||||||
val_min_brightness = getBrightness(
|
val_min_brightness = getBrightness(
|
||||||
ref_vertices.begin()->getColor() );
|
ptr_vertices->begin()->getColor() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -725,6 +727,11 @@ namespace
|
||||||
|
|
||||||
private: // gl API handling
|
private: // gl API handling
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define glBindVertexArray glBindVertexArrayAPPLE
|
||||||
|
#define glGenVertexArrays glGenVertexArraysAPPLE
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
|
||||||
|
#endif
|
||||||
void glAlloc()
|
void glAlloc()
|
||||||
{
|
{
|
||||||
glGenVertexArrays(1, & hnd_vao);
|
glGenVertexArrays(1, & hnd_vao);
|
||||||
|
@ -739,13 +746,12 @@ namespace
|
||||||
{
|
{
|
||||||
GLuint vbo;
|
GLuint vbo;
|
||||||
glGenBuffers(1, & vbo);
|
glGenBuffers(1, & vbo);
|
||||||
|
|
||||||
|
glBindVertexArray(hnd_vao);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
n * sizeof(GpuVertex), arr_data, GL_STATIC_DRAW);
|
n * sizeof(GpuVertex), arr_data, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glBindVertexArray(hnd_vao);
|
|
||||||
glInterleavedArrays(GL_C4UB_V3F, sizeof(GpuVertex), 0l);
|
glInterleavedArrays(GL_C4UB_V3F, sizeof(GpuVertex), 0l);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
@ -780,6 +786,11 @@ namespace
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#undef glBindVertexArray
|
||||||
|
#undef glGenVertexArrays
|
||||||
|
#undef glDeleteVertexArrays
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
TileCulling::TileCulling(
|
TileCulling::TileCulling(
|
||||||
|
|
Loading…
Reference in a new issue