From f961a2fb478a44958d4cf727ebabff99252133b0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 8 Nov 2008 12:55:48 +0000 Subject: parse model geometry without vertexbuffer --- src/model/map.cc | 100 ++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/model/map.cc b/src/model/map.cc index 960a1f0..584240f 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -142,21 +142,21 @@ bool Map::getline() } else if (firstword == "}") { if ((parse_level == 2) && (planes.size())) { - // end-of-brush - if (VertexArray::instance()) { - // for every face - for (std::vector::iterator face = planes.begin(); face != planes.end(); face++) { - make_brushface((*face)); - } - - // clean planes - for (std::vector::iterator it = planes.begin(); it != planes.end(); it++) { - delete(*it); - } - planes.clear(); - - map_brushes++; + // end-of-brush + + // for every face + for (std::vector::iterator face = planes.begin(); face != planes.end(); face++) { + make_brushface((*face)); } + + // clean planes + for (std::vector::iterator it = planes.begin(); it != planes.end(); it++) { + delete(*it); + } + planes.clear(); + + map_brushes++; + value_current.clear(); } else if ((parse_level == 1)) { @@ -200,42 +200,42 @@ bool Map::getline() if (firstword == "(") { // brush plane - if (VertexArray::instance()) { - Vector3f p1, p2, p3; - std::string tmp; - std::string texture; - int n = 0; + + Vector3f p1, p2, p3; + std::string tmp; + std::string texture; + int n = 0; + + linestream >> p1; + linestream >> tmp; // ) + linestream >> tmp; // ( + linestream >> p2; + linestream >> tmp; // ) + linestream >> tmp; // ( + linestream >> p3; + linestream >> tmp; // ) + linestream >> texture; + + // 5 numbers (texture alignment?) + for (int i=0; i < 5; i++) + linestream >> tmp; - linestream >> p1; - linestream >> tmp; // ) - linestream >> tmp; // ( - linestream >> p2; - linestream >> tmp; // ) - linestream >> tmp; // ( - linestream >> p3; - linestream >> tmp; // ) - linestream >> texture; + // content flags ? + if (!(linestream >> n)) + n = 0; - // 5 numbers (texture alignment?) - for (int i=0; i < 5; i++) - linestream >> tmp; - - // content flags ? - if (!(linestream >> n)) - n = 0; - - Plane *plane = new Plane(p1, p2, p3); - plane->texture() = texture; - if (n > 0) - plane->detail() = true; - - // surface flags - if (!(linestream >> n)) - n = 0; - plane->surface_flags() = n; + Plane *plane = new Plane(p1, p2, p3); + plane->texture() = texture; + if (n > 0) + plane->detail() = true; - planes.push_back(plane); - } + // surface flags + if (!(linestream >> n)) + n = 0; + plane->surface_flags() = n; + + planes.push_back(plane); + value_current.clear(); } } @@ -678,11 +678,7 @@ void Map::close() } void Map::load_worldspawn(Model *model) -{ - // set default values - if (!VertexArray::instance() || VertexArray::instance()->overflow()) - return; - +{ if (!map_materials.size()) return; -- cgit v1.2.3