+++ /dev/null
-/**
- * MQO\8c`\8e®
- * \83\81\83^\83Z\83R\83C\83A\82Ì\83\82\83f\83\8b\83f\81[\83^\81B\83e\83L\83X\83g\8c`\8e®\81B
- * \83}\83e\83\8a\83A\83\8b\8fî\95ñ\82Æ\8c`\8fó\83f\81[\83^\82ð\95Û\8e\9d\82·\82é\81B
- * \83\82\83f\83\8a\83\93\83O\8cü\82¯\82É\88Ù\82È\82é\92¸\93_\91®\90«\82ð\8e\9d\82Â\92¸\93_\82ð\82Ð\82Æ\82Â\82Ì\92¸\93_\82Æ\82µ\82Ä\88µ\82Á\82Ä\82¢\82é\82Ì\82Å\81A
- * \83v\83\8d\83O\83\89\83\80\82Å\92¸\93_\94z\97ñ\82ð\8dì\82é\8fê\8d\87\82Í\83}\83e\83\8a\83A\83\8b\81AUV\82È\82Ç\82ª\88Ù\82È\82é\92l\82ð\8e\9d\82Â\92¸\93_\82ð
- * \95Ê\82Ì\92¸\93_\82Æ\82µ\82Ä\95ª\97£\82·\82é\8dì\8bÆ\82ª\95K\97v\82É\82È\82é\81B
- * \96@\90ü\82Í\8cv\8eZ\82µ\82Ä\8eZ\8fo\82·\82é\95K\97v\82ª\82 \82é\81B
- *
- * \8dÀ\95W\8cn
- * \89E\8eè Y-UP
- *
- * \96Ê\82Ì\95\
- * clock wise ?
- *
- * UV\8c´\93_
- * left top ?
- *
- * \96@\90ü
- * \83I\83u\83W\83F\83N\83g\82Ì\95Û\8e\9d\82·\82é\83X\83\80\81[\83W\83\93\83O\92l\82ð\8eQ\8fÆ\82µ\82Ä\96Ê\96@\90ü\82©\82ç\8cv\8eZ\82·\82é\81B
- *
- * \97 \96Ê\82Ì\88µ\82¢
- * \83I\83\8a\83W\83i\83\8b\82Å\82Í\83o\83b\83N\83J\83\8a\83\93\83O\97L\8cø\81B
- *
- * MIKOTO\95û\8e®\82Ì\83{\81[\83\93
- * MQO\82Í\95W\8f\80\82Å\83X\83L\83j\83\93\83O\8fî\95ñ\82ð\8e\9d\82½\82È\82¢\82ª\81A\93Á\92è\82Ì\83\8b\81[\83\8b\82Å\83}\83e\83\8a\83A\83\8b\82Æ\83I\83u\83W\83F\83N\83g
- * \82ð\8dì\90¬\82·\82é\82±\82Æ\82Å\82±\82ê\82ð\8dì\90¬\82·\82é\81B
- *
- * \8eQ\8dl\83T\83C\83g
- * http://www.metaseq.net/metaseq/format.html
- */
-
-#ifndef MESH_IO_MQO_H_INCLUDED
-#define MESH_IO_MQO_H_INCLUDED
-
-#include <iosfwd>
-#include <vector>
-#include "la.h"
-#include "color.h"
-#include "text.h"
-
-namespace meshio {
-namespace mqo {
-
-typedef ::meshio::la::Vector2 Vector2;
-typedef ::meshio::la::Vector3 Vector3;
-typedef ::meshio::la::Vector4 Vector4;
-typedef ::meshio::color::fRGBA RGBA;
-
-//! Scene\83`\83\83\83\93\83N
-struct Scene
-{
- Vector3 pos;
- Vector3 lookat;
- float head;
- float pitch;
- int ortho;
- float zoom2;
- Vector3 ambient;
- Scene()
- : head(0), pitch(0), ortho(false), zoom2(2)
- {}
-};
-inline std::ostream &operator<<(std::ostream &os, const Scene &rhs)
-{
- os
- << "<Scene"
- << " pos: " << rhs.pos
- << ", lookat: " << rhs.lookat
- << ", head: " << rhs.head
- << ", pitch: " << rhs.pitch
- << ", ortho: " << rhs.ortho
- << ", zoom2: " << rhs.zoom2
- << ", ambient: " << rhs.ambient
- << ">"
- ;
- return os;
-}
-
-//! Material\83`\83\83\83\93\83N
-struct Material
-{
- std::string name;
- int shader;
- RGBA color;
- float diffuse;
- float ambient;
- float emit;
- float specular;
- float power;
- std::string texture;
- std::string alphamap;
- std::string bumpmap;
- int vcol;
-
- Material()
- : shader(0), diffuse(1), ambient(0), emit(0), specular(0), power(0),
- vcol(0)
- {}
-
- // for python3 unicode
- std::wstring getName()const;
- std::wstring getTexture()const;
-};
-inline std::ostream &operator<<(std::ostream &os, const Material &rhs)
-{
- os
- << "<Material "
- << '"' << rhs.name << '"'
- << " shader:" << rhs.shader
- << ", color:" << rhs.color
- << ", diffuse:" << rhs.diffuse
- << ", ambient:" << rhs.ambient
- << ", emit:" << rhs.emit
- << ", specular:" << rhs.specular
- << ", power:" << rhs.power
- << ", texture:\"" << rhs.texture << '"'
- << ", alphamap:\"" << rhs.alphamap << '"'
- << ", bumpmap:\"" << rhs.bumpmap << '"'
- << ">"
- ;
- return os;
-}
-
-//! face\83`\83\83\83\93\83N
-struct Face
-{
- unsigned int index_count;
- unsigned int indices[4];
- unsigned int material_index;
- Vector2 uv[4];
- RGBA color[4];
- Face()
- : index_count(0), material_index(0)
- {
- indices[0]=0;
- indices[1]=0;
- indices[2]=0;
- indices[3]=0;
- uv[0]=Vector2();
- uv[1]=Vector2();
- uv[2]=Vector2();
- uv[3]=Vector2();
- }
- int getIndex(int i){ return indices[i]; }
- Vector2 getUV(int i){ return uv[i]; }
-};
-inline std::ostream &operator<<(std::ostream &os, const Face &rhs)
-{
- switch(rhs.index_count)
- {
- case 2:
- os
- << "<Edge "
- << "indices:{" << rhs.indices[0] << ',' << rhs.indices[1] << "}"
- << ", material_index: " << rhs.material_index
- << ", uv:{" << rhs.uv[0] << ',' << rhs.uv[1] << "}"
- << ", color:{" << rhs.color[0] << ',' << rhs.color[1] << "}"
- << ">"
- ;
- break;
-
- case 3:
- os
- << "<Triangle "
- << "indices:{" << rhs.indices[0]
- << ',' << rhs.indices[1]
- << ',' << rhs.indices[2] << "}"
- << ", material_index: " << rhs.material_index
- << ", uv:{" << rhs.uv[0] << ',' << rhs.uv[1] << ',' << rhs.uv[2] << "}"
- << ", color:{"
- << rhs.color[0] << ',' << rhs.color[1] << ',' << rhs.color[2] << "}"
- << ">"
- ;
- break;
-
- case 4:
- os
- << "<Rectangle "
- << "indices:{" << rhs.indices[0]
- << ',' << rhs.indices[1]
- << ',' << rhs.indices[2]
- << ',' << rhs.indices[3] << "}"
- << ", material_index: " << rhs.material_index
- << ", uv:{" << rhs.uv[0] << ',' << rhs.uv[1]
- << ',' << rhs.uv[2] << ',' << rhs.uv[3] << "}"
- << ", color:{" << rhs.color[0]
- << ',' << rhs.color[1]
- << ',' << rhs.color[2]
- << ',' << rhs.color[3] << "}"
- << ">"
- ;
- break;
- default:
- assert(false);
- }
-
- return os;
-}
-
-//! Object\83`\83\83\83\93\83N
-struct Object
-{
- std::string name;
- int depth;
- int folding;
- Vector3 scale;
- Vector3 rotation;
- Vector3 translation;
- int visible;
- int locking;
- int shading;
- float smoothing;
- Vector3 color;
- int color_type;
- int mirror;
-
- std::vector<Vector3> vertices;
- std::vector<Face> faces;
-
- Object()
- : depth(0), folding(0), visible(1), locking(0), shading(0),
- smoothing(60.0f), color_type(0), mirror(0)
- {}
-
- std::wstring getName()const;
-};
-inline std::ostream &operator<<(std::ostream &os, const Object &rhs)
-{
- os
- << "<Object "
- << '"' << rhs.name << '"'
- << " vertices:" << rhs.vertices.size()
- << ", faces:" << rhs.faces.size()
- << ">"
- ;
- return os;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// IO
-///////////////////////////////////////////////////////////////////////////////
-struct IO
-{
- Scene scene;
- std::vector<Material> materials;
- std::vector<Object> objects;
-
- bool read(binary::IReader &reader);
- bool read(const char *path);
-#ifdef _WIN32
- bool read(const wchar_t *path);
-#endif
- bool write(binary::IWriter &writer);
- bool write(const char *path);
-};
-
-} // namespace mqo
-} // namespace meshio
-
-#endif // MESH_IO_MQO_H_INCLUDED