From fcad68bf2d819bd0cdb7975ab956b8cf0f6bfac0 Mon Sep 17 00:00:00 2001 From: Olivier Date: Wed, 21 Oct 2015 03:23:06 +0200 Subject: [PATCH] update --- python/cornell_box_multimaterial_output.json | 581 ++++++++++++++++++ python/cornell_box_output.json | 601 ------------------- python/howto.py | 4 +- python/main.cpp | 23 +- python/pyTOL.cbp.mak | 96 --- 5 files changed, 599 insertions(+), 706 deletions(-) create mode 100644 python/cornell_box_multimaterial_output.json delete mode 100644 python/cornell_box_output.json delete mode 100644 python/pyTOL.cbp.mak diff --git a/python/cornell_box_multimaterial_output.json b/python/cornell_box_multimaterial_output.json new file mode 100644 index 0000000..ac2de10 --- /dev/null +++ b/python/cornell_box_multimaterial_output.json @@ -0,0 +1,581 @@ +{ + "shapes": { + "back_wall": { + "material_ids": [ + 0.0, + 0.0 + ], + "normals": [], + "positions": [ + 549.5999755859375, + 0.0, + 559.2000122070312, + 0.0, + 0.0, + 559.2000122070312, + 0.0, + 548.7999877929688, + 559.2000122070312, + 556.0, + 548.7999877929688, + 559.2000122070312 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0 + ], + "texcoords": [] + }, + "floor": { + "material_ids": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "normals": [], + "positions": [ + 552.7999877929688, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 559.2000122070312, + 549.5999755859375, + 0.0, + 559.2000122070312, + 290.0, + 0.0, + 114.0, + 240.0, + 0.0, + 272.0, + 82.0, + 0.0, + 225.0, + 130.0, + 0.0, + 65.0, + 472.0, + 0.0, + 406.0, + 314.0, + 0.0, + 456.0, + 265.0, + 0.0, + 296.0, + 423.0, + 0.0, + 247.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 4.0, + 6.0, + 7.0, + 8.0, + 9.0, + 10.0, + 8.0, + 10.0, + 11.0 + ], + "texcoords": [] + }, + "red_wall": { + "material_ids": [ + 1.0, + 1.0 + ], + "normals": [], + "positions": [ + 552.7999877929688, + 0.0, + 0.0, + 549.5999755859375, + 0.0, + 559.2000122070312, + 556.0, + 548.7999877929688, + 559.2000122070312, + 556.0, + 548.7999877929688, + 0.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0 + ], + "texcoords": [] + }, + "light": { + "material_ids": [ + 4.0, + 4.0 + ], + "normals": [], + "positions": [ + 343.0, + 548.0, + 227.0, + 343.0, + 548.0, + 332.0, + 213.0, + 548.0, + 332.0, + 213.0, + 548.0, + 227.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0 + ], + "texcoords": [] + }, + "tall_block": { + "material_ids": [ + 2.0, + 2.0, + 2.0, + 2.0 + ], + "normals": [], + "positions": [ + 314.0, + 0.0, + 456.0, + 314.0, + 330.0, + 456.0, + 265.0, + 330.0, + 296.0, + 265.0, + 0.0, + 296.0, + 265.0, + 0.0, + 296.0, + 265.0, + 330.0, + 296.0, + 423.0, + 330.0, + 247.0, + 423.0, + 0.0, + 247.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 4.0, + 6.0, + 7.0 + ], + "texcoords": [] + }, + "short_block": { + "material_ids": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "normals": [], + "positions": [ + 130.0, + 165.0, + 65.0, + 82.0, + 165.0, + 225.0, + 240.0, + 165.0, + 272.0, + 290.0, + 165.0, + 114.0, + 290.0, + 0.0, + 114.0, + 290.0, + 165.0, + 114.0, + 240.0, + 165.0, + 272.0, + 240.0, + 0.0, + 272.0, + 130.0, + 0.0, + 65.0, + 130.0, + 165.0, + 65.0, + 290.0, + 165.0, + 114.0, + 290.0, + 0.0, + 114.0, + 82.0, + 0.0, + 225.0, + 82.0, + 165.0, + 225.0, + 130.0, + 165.0, + 65.0, + 130.0, + 0.0, + 65.0, + 240.0, + 0.0, + 272.0, + 240.0, + 165.0, + 272.0, + 82.0, + 165.0, + 225.0, + 82.0, + 0.0, + 225.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 4.0, + 6.0, + 7.0, + 8.0, + 9.0, + 10.0, + 8.0, + 10.0, + 11.0, + 12.0, + 13.0, + 14.0, + 12.0, + 14.0, + 15.0, + 16.0, + 17.0, + 18.0, + 16.0, + 18.0, + 19.0 + ], + "texcoords": [] + }, + "green_wall": { + "material_ids": [ + 2.0, + 2.0 + ], + "normals": [], + "positions": [ + 0.0, + 0.0, + 559.2000122070312, + 0.0, + 0.0, + 0.0, + 0.0, + 548.7999877929688, + 0.0, + 0.0, + 548.7999877929688, + 559.2000122070312 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0 + ], + "texcoords": [] + }, + "ceiling": { + "material_ids": [ + 0.0, + 0.0 + ], + "normals": [], + "positions": [ + 556.0, + 548.7999877929688, + 0.0, + 556.0, + 548.7999877929688, + 559.2000122070312, + 0.0, + 548.7999877929688, + 559.2000122070312, + 0.0, + 548.7999877929688, + 0.0 + ], + "indicies": [ + 0.0, + 1.0, + 2.0, + 0.0, + 2.0, + 3.0 + ], + "texcoords": [] + } + }, + "materials": { + "blue": { + "diffuse_texname": "", + "ambient_texname": "", + "illum": 0, + "displacement_texname": "", + "alpha_texname": "", + "emission": [ + 0.0, + 0.0, + 0.0 + ], + "transmittance": [ + 0.0, + 0.0, + 0.0 + ], + "ambient": [ + 0.0, + 0.0, + 0.0 + ], + "bump_texname": "", + "diffuse": [ + 0.0, + 0.0, + 1.0 + ], + "shininess": 1.0, + "specular_highlight_texname": "", + "unknown_parameter": {}, + "ior": 1.0, + "dissolve": 1.0, + "specular": [ + 0.0, + 0.0, + 0.0 + ], + "specular_texname": "" + }, + "white": { + "diffuse_texname": "", + "ambient_texname": "", + "illum": 0, + "displacement_texname": "", + "alpha_texname": "", + "emission": [ + 0.0, + 0.0, + 0.0 + ], + "transmittance": [ + 0.0, + 0.0, + 0.0 + ], + "ambient": [ + 0.0, + 0.0, + 0.0 + ], + "bump_texname": "", + "diffuse": [ + 1.0, + 1.0, + 1.0 + ], + "shininess": 1.0, + "specular_highlight_texname": "", + "unknown_parameter": {}, + "ior": 1.0, + "dissolve": 1.0, + "specular": [ + 0.0, + 0.0, + 0.0 + ], + "specular_texname": "" + }, + "red": { + "diffuse_texname": "", + "ambient_texname": "", + "illum": 0, + "displacement_texname": "", + "alpha_texname": "", + "emission": [ + 0.0, + 0.0, + 0.0 + ], + "transmittance": [ + 0.0, + 0.0, + 0.0 + ], + "ambient": [ + 0.0, + 0.0, + 0.0 + ], + "bump_texname": "", + "diffuse": [ + 1.0, + 0.0, + 0.0 + ], + "shininess": 1.0, + "specular_highlight_texname": "", + "unknown_parameter": {}, + "ior": 1.0, + "dissolve": 1.0, + "specular": [ + 0.0, + 0.0, + 0.0 + ], + "specular_texname": "" + }, + "light": { + "diffuse_texname": "", + "ambient_texname": "", + "illum": 0, + "displacement_texname": "", + "alpha_texname": "", + "emission": [ + 0.0, + 0.0, + 0.0 + ], + "transmittance": [ + 0.0, + 0.0, + 0.0 + ], + "ambient": [ + 20.0, + 20.0, + 20.0 + ], + "bump_texname": "", + "diffuse": [ + 1.0, + 1.0, + 1.0 + ], + "shininess": 1.0, + "specular_highlight_texname": "", + "unknown_parameter": {}, + "ior": 1.0, + "dissolve": 1.0, + "specular": [ + 0.0, + 0.0, + 0.0 + ], + "specular_texname": "" + }, + "green": { + "diffuse_texname": "", + "ambient_texname": "", + "illum": 0, + "displacement_texname": "", + "alpha_texname": "", + "emission": [ + 0.0, + 0.0, + 0.0 + ], + "transmittance": [ + 0.0, + 0.0, + 0.0 + ], + "ambient": [ + 0.0, + 0.0, + 0.0 + ], + "bump_texname": "", + "diffuse": [ + 0.0, + 1.0, + 0.0 + ], + "shininess": 1.0, + "specular_highlight_texname": "", + "unknown_parameter": {}, + "ior": 1.0, + "dissolve": 1.0, + "specular": [ + 0.0, + 0.0, + 0.0 + ], + "specular_texname": "" + } + } +} diff --git a/python/cornell_box_output.json b/python/cornell_box_output.json deleted file mode 100644 index ba2e7e1..0000000 --- a/python/cornell_box_output.json +++ /dev/null @@ -1,601 +0,0 @@ -{ - "shapes": { - "ceiling": { - "texcoords": [], - "positions": [ - 556.0, - 548.7999877929688, - 0.0, - 556.0, - 548.7999877929688, - 559.2000122070312, - 0.0, - 548.7999877929688, - 559.2000122070312, - 0.0, - 548.7999877929688, - 0.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0 - ], - "material_ids": [ - 0.0, - 0.0 - ], - "normals": [] - }, - "floor": { - "texcoords": [], - "positions": [ - 552.7999877929688, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 559.2000122070312, - 549.5999755859375, - 0.0, - 559.2000122070312, - 290.0, - 0.0, - 114.0, - 240.0, - 0.0, - 272.0, - 82.0, - 0.0, - 225.0, - 130.0, - 0.0, - 65.0, - 472.0, - 0.0, - 406.0, - 314.0, - 0.0, - 456.0, - 265.0, - 0.0, - 296.0, - 423.0, - 0.0, - 247.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 4.0, - 6.0, - 7.0, - 8.0, - 9.0, - 10.0, - 8.0, - 10.0, - 11.0 - ], - "material_ids": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "normals": [] - }, - "light": { - "texcoords": [], - "positions": [ - 343.0, - 548.0, - 227.0, - 343.0, - 548.0, - 332.0, - 213.0, - 548.0, - 332.0, - 213.0, - 548.0, - 227.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0 - ], - "material_ids": [ - 4.0, - 4.0 - ], - "normals": [] - }, - "green_wall": { - "texcoords": [], - "positions": [ - 0.0, - 0.0, - 559.2000122070312, - 0.0, - 0.0, - 0.0, - 0.0, - 548.7999877929688, - 0.0, - 0.0, - 548.7999877929688, - 559.2000122070312 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0 - ], - "material_ids": [ - 2.0, - 2.0 - ], - "normals": [] - }, - "back_wall": { - "texcoords": [], - "positions": [ - 549.5999755859375, - 0.0, - 559.2000122070312, - 0.0, - 0.0, - 559.2000122070312, - 0.0, - 548.7999877929688, - 559.2000122070312, - 556.0, - 548.7999877929688, - 559.2000122070312 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0 - ], - "material_ids": [ - 0.0, - 0.0 - ], - "normals": [] - }, - "short_block": { - "texcoords": [], - "positions": [ - 130.0, - 165.0, - 65.0, - 82.0, - 165.0, - 225.0, - 240.0, - 165.0, - 272.0, - 290.0, - 165.0, - 114.0, - 290.0, - 0.0, - 114.0, - 290.0, - 165.0, - 114.0, - 240.0, - 165.0, - 272.0, - 240.0, - 0.0, - 272.0, - 130.0, - 0.0, - 65.0, - 130.0, - 165.0, - 65.0, - 290.0, - 165.0, - 114.0, - 290.0, - 0.0, - 114.0, - 82.0, - 0.0, - 225.0, - 82.0, - 165.0, - 225.0, - 130.0, - 165.0, - 65.0, - 130.0, - 0.0, - 65.0, - 240.0, - 0.0, - 272.0, - 240.0, - 165.0, - 272.0, - 82.0, - 165.0, - 225.0, - 82.0, - 0.0, - 225.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 4.0, - 6.0, - 7.0, - 8.0, - 9.0, - 10.0, - 8.0, - 10.0, - 11.0, - 12.0, - 13.0, - 14.0, - 12.0, - 14.0, - 15.0, - 16.0, - 17.0, - 18.0, - 16.0, - 18.0, - 19.0 - ], - "material_ids": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "normals": [] - }, - "tall_block": { - "texcoords": [], - "positions": [ - 423.0, - 0.0, - 247.0, - 423.0, - 330.0, - 247.0, - 472.0, - 330.0, - 406.0, - 472.0, - 0.0, - 406.0, - 472.0, - 0.0, - 406.0, - 472.0, - 330.0, - 406.0, - 314.0, - 330.0, - 456.0, - 314.0, - 0.0, - 456.0, - 314.0, - 0.0, - 456.0, - 314.0, - 330.0, - 456.0, - 265.0, - 330.0, - 296.0, - 265.0, - 0.0, - 296.0, - 265.0, - 0.0, - 296.0, - 265.0, - 330.0, - 296.0, - 423.0, - 330.0, - 247.0, - 423.0, - 0.0, - 247.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 4.0, - 6.0, - 7.0, - 8.0, - 9.0, - 10.0, - 8.0, - 10.0, - 11.0, - 12.0, - 13.0, - 14.0, - 12.0, - 14.0, - 15.0 - ], - "material_ids": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "normals": [] - }, - "red_wall": { - "texcoords": [], - "positions": [ - 552.7999877929688, - 0.0, - 0.0, - 549.5999755859375, - 0.0, - 559.2000122070312, - 556.0, - 548.7999877929688, - 559.2000122070312, - 556.0, - 548.7999877929688, - 0.0 - ], - "indicies": [ - 0.0, - 1.0, - 2.0, - 0.0, - 2.0, - 3.0 - ], - "material_ids": [ - 1.0, - 1.0 - ], - "normals": [] - } - }, - "materials": { - "blue": { - "transmittance": [ - 0.0, - 0.0, - 0.0 - ], - "illum": 0, - "emission": [ - 0.0, - 0.0, - 0.0 - ], - "diffuse_texname": "", - "ambient_texname": "", - "normal_texname": "", - "shininess": 1.0, - "ior": 1.0, - "specular": [ - 0.0, - 0.0, - 0.0 - ], - "specular_texname": "", - "diffuse": [ - 0.0, - 0.0, - 1.0 - ], - "ambient": [ - 0.0, - 0.0, - 0.0 - ], - "dissolve": 1.0 - }, - "light": { - "transmittance": [ - 0.0, - 0.0, - 0.0 - ], - "illum": 0, - "emission": [ - 0.0, - 0.0, - 0.0 - ], - "diffuse_texname": "", - "ambient_texname": "", - "normal_texname": "", - "shininess": 1.0, - "ior": 1.0, - "specular": [ - 0.0, - 0.0, - 0.0 - ], - "specular_texname": "", - "diffuse": [ - 1.0, - 1.0, - 1.0 - ], - "ambient": [ - 20.0, - 20.0, - 20.0 - ], - "dissolve": 1.0 - }, - "white": { - "transmittance": [ - 0.0, - 0.0, - 0.0 - ], - "illum": 0, - "emission": [ - 0.0, - 0.0, - 0.0 - ], - "diffuse_texname": "", - "ambient_texname": "", - "normal_texname": "", - "shininess": 1.0, - "ior": 1.0, - "specular": [ - 0.0, - 0.0, - 0.0 - ], - "specular_texname": "", - "diffuse": [ - 1.0, - 1.0, - 1.0 - ], - "ambient": [ - 0.0, - 0.0, - 0.0 - ], - "dissolve": 1.0 - }, - "green": { - "transmittance": [ - 0.0, - 0.0, - 0.0 - ], - "illum": 0, - "emission": [ - 0.0, - 0.0, - 0.0 - ], - "diffuse_texname": "", - "ambient_texname": "", - "normal_texname": "", - "shininess": 1.0, - "ior": 1.0, - "specular": [ - 0.0, - 0.0, - 0.0 - ], - "specular_texname": "", - "diffuse": [ - 0.0, - 1.0, - 0.0 - ], - "ambient": [ - 0.0, - 0.0, - 0.0 - ], - "dissolve": 1.0 - }, - "red": { - "transmittance": [ - 0.0, - 0.0, - 0.0 - ], - "illum": 0, - "emission": [ - 0.0, - 0.0, - 0.0 - ], - "diffuse_texname": "", - "ambient_texname": "", - "normal_texname": "", - "shininess": 1.0, - "ior": 1.0, - "specular": [ - 0.0, - 0.0, - 0.0 - ], - "specular_texname": "", - "diffuse": [ - 1.0, - 0.0, - 0.0 - ], - "ambient": [ - 0.0, - 0.0, - 0.0 - ], - "dissolve": 1.0 - } - } -} diff --git a/python/howto.py b/python/howto.py index c526821..a4c6e04 100644 --- a/python/howto.py +++ b/python/howto.py @@ -1,11 +1,9 @@ import tinyobjloader as tol import json -model = tol.LoadObj("cornell_box.obj") +model = tol.LoadObj("cornell_box_multimaterial.obj") #print(model["shapes"], model["materials"]) print( json.dumps(model, indent=4) ) #see cornell_box_output.json - - diff --git a/python/main.cpp b/python/main.cpp index b2c6e96..6ae89cc 100644 --- a/python/main.cpp +++ b/python/main.cpp @@ -31,7 +31,7 @@ extern "C" static PyObject* pyLoadObj(PyObject* self, PyObject* args) { - PyObject *rtndict, *pyshapes, *pymaterials, + PyObject *rtndict, *pyshapes, *pymaterials, *current, *meshobj; char const* filename; @@ -62,7 +62,7 @@ pyLoadObj(PyObject* self, PyObject* args) switch(i) { - case 0: + case 0: current_name = "positions"; vect = vectd(cm.positions.begin(), cm.positions.end()); break; case 1: @@ -77,9 +77,9 @@ pyLoadObj(PyObject* self, PyObject* args) case 4: current_name = "material_ids"; vect = vectd(cm.material_ids.begin(), cm.material_ids.end()); break; - + } - + for (vectd::iterator it = vect.begin() ; it != vect.end(); it++) { @@ -87,7 +87,7 @@ pyLoadObj(PyObject* self, PyObject* args) } PyDict_SetItemString(meshobj, current_name, current); - + } PyDict_SetItemString(pyshapes, (*shape).name.c_str(), meshobj); @@ -97,6 +97,13 @@ pyLoadObj(PyObject* self, PyObject* args) mat != materials.end(); mat++) { PyObject *matobj = PyDict_New(); + PyObject *unknown_parameter = PyDict_New(); + + for (std::map::iterator p = (*mat).unknown_parameter.begin() ; + p != (*mat).unknown_parameter.end(); ++p) + { + PyDict_SetItemString(unknown_parameter, p->first.c_str(), PyUnicode_FromString(p->second.c_str())); + } PyDict_SetItemString(matobj, "shininess", PyFloat_FromDouble((*mat).shininess)); PyDict_SetItemString(matobj, "ior", PyFloat_FromDouble((*mat).ior)); @@ -105,12 +112,16 @@ pyLoadObj(PyObject* self, PyObject* args) PyDict_SetItemString(matobj, "ambient_texname", PyUnicode_FromString((*mat).ambient_texname.c_str())); PyDict_SetItemString(matobj, "diffuse_texname", PyUnicode_FromString((*mat).diffuse_texname.c_str())); PyDict_SetItemString(matobj, "specular_texname", PyUnicode_FromString((*mat).specular_texname.c_str())); - PyDict_SetItemString(matobj, "normal_texname", PyUnicode_FromString((*mat).normal_texname.c_str())); + PyDict_SetItemString(matobj, "specular_highlight_texname", PyUnicode_FromString((*mat).specular_highlight_texname.c_str())); + PyDict_SetItemString(matobj, "bump_texname", PyUnicode_FromString((*mat).bump_texname.c_str())); + PyDict_SetItemString(matobj, "displacement_texname", PyUnicode_FromString((*mat).displacement_texname.c_str())); + PyDict_SetItemString(matobj, "alpha_texname", PyUnicode_FromString((*mat).alpha_texname.c_str())); PyDict_SetItemString(matobj, "ambient", pyTupleFromfloat3((*mat).ambient)); PyDict_SetItemString(matobj, "diffuse", pyTupleFromfloat3((*mat).diffuse)); PyDict_SetItemString(matobj, "specular", pyTupleFromfloat3((*mat).specular)); PyDict_SetItemString(matobj, "transmittance", pyTupleFromfloat3((*mat).transmittance)); PyDict_SetItemString(matobj, "emission", pyTupleFromfloat3((*mat).emission)); + PyDict_SetItemString(matobj, "unknown_parameter", unknown_parameter); PyDict_SetItemString(pymaterials, (*mat).name.c_str(), matobj); } diff --git a/python/pyTOL.cbp.mak b/python/pyTOL.cbp.mak deleted file mode 100644 index ba18ae9..0000000 --- a/python/pyTOL.cbp.mak +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------# -# This makefile was generated by 'cbp2make' tool rev.147 # -#------------------------------------------------------------------------------# - - -WORKDIR = `pwd` - -CC = gcc -CXX = g++ -AR = ar -LD = g++ -WINDRES = windres - -INC = -CFLAGS = -Wall -fexceptions `python3-config --cflags` -RESINC = -LIBDIR = -LIB = -LDFLAGS = `python3-config --ldflags` - -INC_DEBUG = $(INC) -CFLAGS_DEBUG = $(CFLAGS) -g -RESINC_DEBUG = $(RESINC) -RCFLAGS_DEBUG = $(RCFLAGS) -LIBDIR_DEBUG = $(LIBDIR) -LIB_DEBUG = $(LIB) -LDFLAGS_DEBUG = $(LDFLAGS) -OBJDIR_DEBUG = obj/Debug -DEP_DEBUG = -OUT_DEBUG = bin/Debug/tinyobjloader.so - -INC_RELEASE = $(INC) -CFLAGS_RELEASE = $(CFLAGS) -O2 -RESINC_RELEASE = $(RESINC) -RCFLAGS_RELEASE = $(RCFLAGS) -LIBDIR_RELEASE = $(LIBDIR) -LIB_RELEASE = $(LIB) -LDFLAGS_RELEASE = $(LDFLAGS) -s -OBJDIR_RELEASE = obj/Release -DEP_RELEASE = -OUT_RELEASE = bin/Release/tinyobjloader.so - -OBJ_DEBUG = $(OBJDIR_DEBUG)/main.o $(OBJDIR_DEBUG)/tiny_obj_loader.o - -OBJ_RELEASE = $(OBJDIR_RELEASE)/main.o $(OBJDIR_RELEASE)/tiny_obj_loader.o - -all: debug release - -clean: clean_debug clean_release - -before_debug: - test -d bin/Debug || mkdir -p bin/Debug - test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG) - -after_debug: - -debug: before_debug out_debug after_debug - -out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) - $(LD) -shared $(LIBDIR_DEBUG) $(OBJ_DEBUG) -o $(OUT_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG) - -$(OBJDIR_DEBUG)/main.o: main.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c main.cpp -o $(OBJDIR_DEBUG)/main.o - -$(OBJDIR_DEBUG)/tiny_obj_loader.o: ../tiny_obj_loader.cc - $(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../tiny_obj_loader.cc -o $(OBJDIR_DEBUG)/tiny_obj_loader.o - -clean_debug: - rm -f $(OBJ_DEBUG) $(OUT_DEBUG) - rm -rf bin/Debug - rm -rf $(OBJDIR_DEBUG) - -before_release: - test -d bin/Release || mkdir -p bin/Release - test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE) - -after_release: - -release: before_release out_release after_release - -out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) - $(LD) -shared $(LIBDIR_RELEASE) $(OBJ_RELEASE) -o $(OUT_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE) - -$(OBJDIR_RELEASE)/main.o: main.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c main.cpp -o $(OBJDIR_RELEASE)/main.o - -$(OBJDIR_RELEASE)/tiny_obj_loader.o: ../tiny_obj_loader.cc - $(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../tiny_obj_loader.cc -o $(OBJDIR_RELEASE)/tiny_obj_loader.o - -clean_release: - rm -f $(OBJ_RELEASE) $(OUT_RELEASE) - rm -rf bin/Release - rm -rf $(OBJDIR_RELEASE) - -.PHONY: before_debug after_debug clean_debug before_release after_release clean_release -