X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmesh.cpp;h=ec5bd18cf392e375c36ee49cfcfe9e51050e4d40;hb=be6ffe96ecb4707599fe1a6f620c348760213d46;hp=f6a060215692a01f73ba2f849f83cfdc6c82f9b2;hpb=e9a898f315b5d1396f196d785913a283c30940f2;p=libs%2Fgl.git diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index f6a06021..ec5bd18c 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -1,42 +1,20 @@ -#include -#include -#include -#include #include "buffer.h" #include "error.h" #include "mesh.h" #include "renderer.h" #include "resourcemanager.h" -#include "vertexsetup.h" using namespace std; namespace Msp { namespace GL { -Mesh::Mesh(ResourceManager *rm) +Mesh::Mesh(const VertexFormat &f): + Mesh() { - init(rm); -} - -Mesh::Mesh(const VertexFormat &f, ResourceManager *rm) -{ - init(rm); storage(f); } -void Mesh::init(ResourceManager *rm) -{ - vbuf = 0; - ibuf = 0; - dirty = 0; - disallow_rendering = false; - face_winding = NON_MANIFOLD; - - if(rm) - set_manager(rm); -} - Mesh::~Mesh() { set_manager(0); @@ -102,12 +80,12 @@ void Mesh::check_buffers(unsigned mask) } } -unsigned Mesh::get_n_vertices() const +size_t Mesh::get_n_vertices() const { return vertices.size(); } -char *Mesh::modify_vertex(unsigned i) +char *Mesh::modify_vertex(size_t i) { if(vertices.get_format().empty()) throw invalid_operation("Mesh::modify_vertex"); @@ -226,9 +204,9 @@ Resource::AsyncLoader *Mesh::load(IO::Seekable &io, const Resources *) return new AsyncLoader(*this, io); } -UInt64 Mesh::get_data_size() const +uint64_t Mesh::get_data_size() const { - UInt64 size = 0; + uint64_t size = 0; if(vbuf) size += vbuf->get_size(); if(ibuf)