subd support: n-sided polygons & pixar crease tags

+ optional parameter to triangulate polygons to maintain compatibility
+ added create tag test & example subd crease tag file from OpenSubD source code
This commit is contained in:
dboogert
2016-01-28 18:34:08 +00:00
parent b96ee06bb6
commit 2fcdd32bc3
4 changed files with 309 additions and 56 deletions

View File

@@ -34,12 +34,23 @@ typedef struct
std::map<std::string, std::string> unknown_parameter;
} material_t;
typedef struct
{
std::string name;
std::vector<int> intValues;
std::vector<float> floatValues;
std::vector<std::string> stringValues;
} tag_t;
typedef struct
{
std::vector<float> positions;
std::vector<float> normals;
std::vector<float> texcoords;
std::vector<unsigned int> indices;
std::vector<unsigned char> numVertices; //Is it worth it 255 faces
std::vector<tag_t> tags;
} mesh_t;
typedef struct
@@ -82,7 +93,9 @@ class MaterialFileReader:
std::string LoadObj(
std::vector<shape_t>& shapes, // [output]
const char* filename,
const char* mtl_basepath = NULL);
const char* mtl_basepath = NULL,
bool triangulate = true
);
/// Loads object from a std::istream, uses GetMtlIStreamFn to retrieve
/// std::istream for materials.
@@ -90,7 +103,8 @@ std::string LoadObj(
std::string LoadObj(
std::vector<shape_t>& shapes, // [output]
std::istream& inStream,
MaterialReader& readMatFn);
MaterialReader& readMatFn,
bool triangulate = true);
/// Loads materials into std::map
/// Returns an empty string if successful