kick
|
00001 // 00002 // ObjInterleavedData.h 00003 // KickObjLoader 00004 // 00005 // Created by morten on 9/2/13. 00006 // Copyright (c) 2013 morten. All rights reserved. 00007 // 00008 00009 #pragma once 00010 #include "obj_data.h" 00011 #include <iostream> 00012 #include <vector> 00013 #include <string> 00014 00015 namespace kick { 00016 struct ObjInterleavedIndex { 00017 std::string materialName; 00018 std::vector<int> vertexIndices; 00019 }; 00020 00021 struct ObjInterleavedData { 00022 std::vector<float> interleavedData; 00023 std::vector<ObjInterleavedIndex> indices; 00024 00025 ObjInterleavedData(){} 00026 00027 // Creates interleaved triangles 00028 ObjInterleavedData(ObjData & objData, bool includeTextureCoordinates = true, bool includeNormals = true, int vertexPositionSize = 3, int texCoordinateSize = 2); 00029 00030 bool includeTextureCoordinates = true; 00031 bool includeNormals = true; 00032 int vertexPositionSize = 3; 00033 int texCoordinateSize = 2; 00034 int vertexLength; 00035 const int vertexPosOffset = 0; 00036 int textureOffset = 0; 00037 int normalsOffset = 0; 00038 00039 int vertexCount(); 00040 glm::vec4 vertex(int index); 00041 void setVertex(int index, glm::vec4 value); 00042 glm::vec3 textureCoordinate(int index); 00043 void setTextureCoordinate(int index, glm::vec3 value); 00044 glm::vec3 normal(int index); 00045 void setNormal(int index, glm::vec3 value); 00046 }; 00047 }