Cleaned the ofbx.cpp file to make it c++11
This commit is contained in:
parent
161c2c04f9
commit
ac53416289
|
|
@ -4,5 +4,5 @@ SOURCES += trimesh_import_fbx.cpp \
|
||||||
../../../wrap/openfbx/src/ofbx.cpp \
|
../../../wrap/openfbx/src/ofbx.cpp \
|
||||||
../../../wrap/openfbx/src/miniz.c
|
../../../wrap/openfbx/src/miniz.c
|
||||||
|
|
||||||
CONFIG += c++14
|
CONFIG += c++11
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ static OptionalError<Property*> readProperty(Cursor* cursor)
|
||||||
{
|
{
|
||||||
if (cursor->current == cursor->end) return Error("Reading past the end");
|
if (cursor->current == cursor->end) return Error("Reading past the end");
|
||||||
|
|
||||||
std::unique_ptr<Property> prop = std::make_unique<Property>();
|
std::unique_ptr<Property> prop(new Property());
|
||||||
prop->next = nullptr;
|
prop->next = nullptr;
|
||||||
prop->type = *cursor->current;
|
prop->type = *cursor->current;
|
||||||
++cursor->current;
|
++cursor->current;
|
||||||
|
|
@ -566,19 +566,20 @@ static void deleteElement(Element* el)
|
||||||
{
|
{
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
delete el->first_property;
|
|
||||||
deleteElement(el->child);
|
|
||||||
Element* iter = el;
|
Element* iter = el;
|
||||||
// do not use recursion to avoid stack overflow
|
// do not use recursion to delete siblings to avoid stack overflow
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Element* next = iter->sibling;
|
Element* next = iter->sibling;
|
||||||
|
delete iter->first_property;
|
||||||
|
deleteElement(iter->child);
|
||||||
delete iter;
|
delete iter;
|
||||||
iter = next;
|
iter = next;
|
||||||
} while (iter);
|
} while (iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static OptionalError<u64> readElementOffset(Cursor* cursor, u16 version)
|
static OptionalError<u64> readElementOffset(Cursor* cursor, u16 version)
|
||||||
{
|
{
|
||||||
if (version >= 7500)
|
if (version >= 7500)
|
||||||
|
|
@ -716,7 +717,7 @@ static DataView readTextToken(Cursor* cursor)
|
||||||
|
|
||||||
static OptionalError<Property*> readTextProperty(Cursor* cursor)
|
static OptionalError<Property*> readTextProperty(Cursor* cursor)
|
||||||
{
|
{
|
||||||
std::unique_ptr<Property> prop = std::make_unique<Property>();
|
std::unique_ptr<Property> prop(new Property());
|
||||||
prop->value.is_binary = false;
|
prop->value.is_binary = false;
|
||||||
prop->next = nullptr;
|
prop->next = nullptr;
|
||||||
if (*cursor->current == '"')
|
if (*cursor->current == '"')
|
||||||
|
|
@ -1583,7 +1584,7 @@ template <typename T> static OptionalError<Object*> parse(const Scene& scene, co
|
||||||
|
|
||||||
static OptionalError<Object*> parseCluster(const Scene& scene, const Element& element)
|
static OptionalError<Object*> parseCluster(const Scene& scene, const Element& element)
|
||||||
{
|
{
|
||||||
std::unique_ptr<ClusterImpl> obj = std::make_unique<ClusterImpl>(scene, element);
|
std::unique_ptr<ClusterImpl> obj(new ClusterImpl(scene, element));
|
||||||
|
|
||||||
const Element* transform_link = findChild(element, "TransformLink");
|
const Element* transform_link = findChild(element, "TransformLink");
|
||||||
if (transform_link && transform_link->first_property)
|
if (transform_link && transform_link->first_property)
|
||||||
|
|
@ -2017,7 +2018,7 @@ template <typename T> static void remap(std::vector<T>* out, const std::vector<i
|
||||||
|
|
||||||
static OptionalError<Object*> parseAnimationCurve(const Scene& scene, const Element& element)
|
static OptionalError<Object*> parseAnimationCurve(const Scene& scene, const Element& element)
|
||||||
{
|
{
|
||||||
std::unique_ptr<AnimationCurveImpl> curve = std::make_unique<AnimationCurveImpl>(scene, element);
|
std::unique_ptr<AnimationCurveImpl> curve(new AnimationCurveImpl(scene, element));
|
||||||
|
|
||||||
const Element* times = findChild(element, "KeyTime");
|
const Element* times = findChild(element, "KeyTime");
|
||||||
const Element* values = findChild(element, "KeyValueFloat");
|
const Element* values = findChild(element, "KeyValueFloat");
|
||||||
|
|
@ -2087,7 +2088,7 @@ static OptionalError<Object*> parseGeometry(const Scene& scene, const Element& e
|
||||||
const Element* polys_element = findChild(element, "PolygonVertexIndex");
|
const Element* polys_element = findChild(element, "PolygonVertexIndex");
|
||||||
if (!polys_element || !polys_element->first_property) return Error("Indices missing");
|
if (!polys_element || !polys_element->first_property) return Error("Indices missing");
|
||||||
|
|
||||||
std::unique_ptr<GeometryImpl> geom = std::make_unique<GeometryImpl>(scene, element);
|
std::unique_ptr<GeometryImpl> geom(new GeometryImpl(scene, element));
|
||||||
|
|
||||||
std::vector<Vec3> vertices;
|
std::vector<Vec3> vertices;
|
||||||
if (!parseDoubleVecData(*vertices_element->first_property, &vertices)) return Error("Failed to parse vertices");
|
if (!parseDoubleVecData(*vertices_element->first_property, &vertices)) return Error("Failed to parse vertices");
|
||||||
|
|
@ -2917,7 +2918,7 @@ Object* Object::getParent() const
|
||||||
|
|
||||||
IScene* load(const u8* data, int size)
|
IScene* load(const u8* data, int size)
|
||||||
{
|
{
|
||||||
std::unique_ptr<Scene> scene = std::make_unique<Scene>();
|
std::unique_ptr<Scene> scene(new Scene());
|
||||||
scene->m_data.resize(size);
|
scene->m_data.resize(size);
|
||||||
memcpy(&scene->m_data[0], data, size);
|
memcpy(&scene->m_data[0], data, size);
|
||||||
OptionalError<Element*> root = tokenize(&scene->m_data[0], size);
|
OptionalError<Element*> root = tokenize(&scene->m_data[0], size);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue