kick
|
00001 // 00002 // mesh.h 00003 // KickCPP 00004 // 00005 // Created by Morten Nobel-Jørgensen on 07/12/13. 00006 // Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved. 00007 // 00008 00009 #pragma once 00010 #include <string> 00011 #include <unordered_map> 00012 #include <functional> 00013 #include "kick/core/project_asset.h" 00014 #include "kick/math/aabb.h" 00015 #include "kick/material/shader.h" 00016 #include "kick/core/kickgl.h" 00017 #include "kick/mesh/mesh_data.h" 00018 00019 namespace kick { 00025 class Mesh : public ProjectAsset { 00026 public: 00027 Mesh(); 00028 ~Mesh(); 00029 void bind(Shader * shader); 00030 void render(unsigned int submeshIndex); 00031 std::string name(); 00032 void setName(std::string n); 00033 void setMeshData(std::shared_ptr<MeshData> m); 00034 std::shared_ptr<MeshData> meshData(); 00035 private: 00036 void updateArrayBufferStructure(Shader *shader); 00037 void updateMeshData(MeshData *mesh_data); 00038 std::unordered_map<Shader*, GLuint> mVertexArrayObject; 00039 std::vector<InterleavedRecord> mInterleavedFormat; 00040 std::string mName; 00041 std::shared_ptr<MeshData> mMeshData; 00042 std::vector<SubMeshData> mSubmeshData; 00043 GLuint mVertexBufferId; 00044 GLuint mElementBufferId; 00045 }; 00046 };