25 #include "../loader.h"
33 typedef int32_t Offset;
37 OPTLoader(
const Path& filename, std::shared_ptr<std::istream> data):
40 void into(
Loadable& resource,
const LoaderOptions& options=LoaderOptions());
43 void read_block(std::istream& file, Offset offset);
44 void process_vertex_block(std::istream& file);
45 void process_texcoord_block(std::istream& file);
46 void process_normal_block(std::istream& file);
47 void process_face_block(std::istream& file);
48 void process_reused_texture_block(std::istream& file);
49 void process_lod_block(std::istream& file);
50 void process_embedded_texture_block(std::istream& file);
55 std::vector<Vec3> vertices;
56 std::vector<Vec2> texture_vertices;
57 std::vector<Vec3> vertex_normals;
63 int32_t bytes_per_pixel;
64 std::vector<uint8_t> data;
66 std::vector<Texture> textures;
67 std::string current_texture;
69 std::map<std::string, SubMesh*> texture_submesh;
70 std::map<std::string, TextureID> texture_name_to_id;
78 std::string texture_name;
80 std::vector<std::vector<Triangle> > triangles;
86 const char* name() {
return "opt"; }
87 bool supports(
const Path& filename)
const {
89 return filename.ext() ==
".opt";
92 Loader::ptr loader_for(
const Path& filename, std::shared_ptr<std::istream> data)
const {
93 return Loader::ptr(
new OPTLoader(filename, data));
101 #endif // OPT_LOADER_H