void ModelContainerView::addModelContainer (const std::string& pName, const ModelContainer* pModelContainer ) { // VARArea::UsageHint::WRITE_EVERY_FEW_FRAMES //printf("[VMAP] Adding ModelContainer: %s\n", pName.c_str()); Array<SubModel> SMArray; Vector3 lo, hi; fillSubModelArary (pModelContainer, &pModelContainer->getTreeNode (0), SMArray, lo, hi); for (int i = 0; i < SMArray.size (); ++i) { SubModel sm = SMArray[i]; Array<Vector3> vArray; fillVertexArray (sm, vArray); //break; } }
void RunnerTilemap::draw(const math::bbox2d &screen) { math::vec2i start = tilePos(screen.min); math::vec2i end = tilePos(screen.max) + math::vec2i(1,1); if ((int)m_chunks.size() <= end.x) generateUntil(end.x); glDisable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); glDisable(GL_BLEND); unsigned short c = 0; glColor(m_color); if (start.y < 0) { math::bbox2d quad( math::vec2d((double)start.x,(double) start.y)*m_unitsPerTile, math::vec2d((double)1+end.x,(double) 0)*m_unitsPerTile); fillVertexArray(0, quad); drawVertexArray(1); start.y = 0; } if (start.x < 0) start.x = 0; for (int i = start.x; i < end.x; ++i) { chunk& cur = m_chunks[i]; bool lastColl = false; int lastColly = start.y; for (int j = start.y; j < end.y; ++j) { bool currColl = (j < 0) || (cur.height > j) || ((int)cur.ceil > 4 && (int)(cur.ceil + cur.height) < j); if (!lastColl && currColl) lastColly = j; else if (lastColl && !currColl) { math::bbox2d quad( math::vec2d((double) i+0,(double) lastColly)*m_unitsPerTile, math::vec2d((double) i+1,(double) j)*m_unitsPerTile); fillVertexArray(c, quad); if (++c == VERTEX_ARRAY_SIZE) { drawVertexArray(c); c = 0; } } lastColl = currColl; } if (lastColl) { math::bbox2d quad( math::vec2d((double) i+0,(double) lastColly)*m_unitsPerTile, math::vec2d((double) i+1,(double) end.y)*m_unitsPerTile); fillVertexArray(c, quad); if (++c == VERTEX_ARRAY_SIZE) { drawVertexArray(c); c = 0; } } } if (c) drawVertexArray(c); }