PeriDyno 0.8.2
Classes | Namespaces | Macros | Functions
ofbx.cpp File Reference
#include "ofbx.h"
#include "miniz.h"
#include <cassert>
#include <math.h>
#include <ctype.h>
#include <memory>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>
Include dependency graph for ofbx.cpp:

Go to the source code of this file.

Classes

struct  ofbx::Allocator
 
struct  ofbx::Allocator::Page
 
struct  ofbx::Temporaries
 
struct  ofbx::Video
 
struct  ofbx::Error
 
struct  ofbx::OptionalError< T >
 
struct  ofbx::Header
 
struct  ofbx::Cursor
 
struct  ofbx::Property
 
struct  ofbx::Element
 
struct  ofbx::MeshImpl
 
struct  ofbx::MaterialImpl
 
struct  ofbx::LimbNodeImpl
 
struct  ofbx::NullImpl
 
struct  ofbx::NodeAttributeImpl
 
struct  ofbx::GeometryImpl
 
struct  ofbx::GeometryImpl::NewVertex
 
struct  ofbx::ShapeImpl
 
struct  ofbx::ClusterImpl
 
struct  ofbx::AnimationStackImpl
 
struct  ofbx::AnimationCurveImpl
 
struct  ofbx::SkinImpl
 
struct  ofbx::BlendShapeChannelImpl
 
struct  ofbx::BlendShapeImpl
 
struct  ofbx::PoseImpl
 
struct  ofbx::TextureImpl
 
struct  ofbx::Root
 
struct  ofbx::Scene
 
struct  ofbx::Scene::Connection
 
struct  ofbx::Scene::ObjectPair
 
struct  ofbx::AnimationCurveNodeImpl
 
struct  ofbx::AnimationCurveNodeImpl::Curve
 
struct  ofbx::AnimationLayerImpl
 
struct  ofbx::ParseGeometryJob
 

Namespaces

namespace  ofbx
 

Macros

#define get_property(name, field, type, getter)
 
#define get_time_property(name, field, type, getter)
 

Functions

static void ofbx::setTranslation (const Vec3 &t, Matrix *mtx)
 
static Vec3 ofbx::operator- (const Vec3 &v)
 
static Matrix ofbx::operator* (const Matrix &lhs, const Matrix &rhs)
 
static Matrix ofbx::makeIdentity ()
 
static Matrix ofbx::rotationX (double angle)
 
static Matrix ofbx::rotationY (double angle)
 
static Matrix ofbx::rotationZ (double angle)
 
static Matrix ofbx::getRotationMatrix (const Vec3 &euler, RotationOrder order)
 
double ofbx::fbxTimeToSeconds (i64 value)
 
i64 ofbx::secondsToFbxTime (double value)
 
static Vec3 ofbx::operator* (const Vec3 &v, float f)
 
static Vec3 ofbx::operator+ (const Vec3 &a, const Vec3 &b)
 
template<int SIZE>
static bool ofbx::copyString (char(&destination)[SIZE], const char *source)
 
template<typename T >
static bool ofbx::parseArrayRaw (const Property &property, T *out, int max_size)
 
template<typename T >
static bool ofbx::parseBinaryArray (const Property &property, std::vector< T > *out)
 
static bool ofbx::parseDouble (Property &property, double *out)
 
static const Element * ofbx::findChild (const Element &element, const char *id)
 
static IElement * ofbx::resolveProperty (const Object &obj, const char *name)
 
static int ofbx::resolveEnumProperty (const Object &object, const char *name, int default_value)
 
static Vec3 ofbx::resolveVec3Property (const Object &object, const char *name, const Vec3 &default_value)
 
static bool ofbx::decompress (const u8 *in, size_t in_size, u8 *out, size_t out_size)
 
template<typename T >
static OptionalError< Tofbx::read (Cursor *cursor)
 
static OptionalError< DataView > ofbx::readShortString (Cursor *cursor)
 
static OptionalError< DataView > ofbx::readLongString (Cursor *cursor)
 
static OptionalError< Property * > ofbx::readProperty (Cursor *cursor, Allocator &allocator)
 
static OptionalError< u64 > ofbx::readElementOffset (Cursor *cursor, u16 version)
 
static OptionalError< Element * > ofbx::readElement (Cursor *cursor, u32 version, Allocator &allocator)
 
static bool ofbx::isEndLine (const Cursor &cursor)
 
static void ofbx::skipInsignificantWhitespaces (Cursor *cursor)
 
static void ofbx::skipLine (Cursor *cursor)
 
static void ofbx::skipWhitespaces (Cursor *cursor)
 
static bool ofbx::isTextTokenChar (char c)
 
static DataView ofbx::readTextToken (Cursor *cursor)
 
static OptionalError< Property * > ofbx::readTextProperty (Cursor *cursor, Allocator &allocator)
 
static OptionalError< Element * > ofbx::readTextElement (Cursor *cursor, Allocator &allocator)
 
static OptionalError< Element * > ofbx::tokenizeText (const u8 *data, size_t size, Allocator &allocator)
 
static OptionalError< Element * > ofbx::tokenize (const u8 *data, size_t size, u32 &version, Allocator &allocator)
 
static void ofbx::parseTemplates (const Element &root)
 
void ofbx::parseVideo (Scene &scene, const Element &element, Allocator &allocator)
 
struct OptionalError< Object * > ofbx::parseTexture (const Scene &scene, const Element &element, Allocator &allocator)
 
struct OptionalError< Object * > ofbx::parsePose (const Scene &scene, const Element &element, Allocator &allocator)
 
template<typename T >
static OptionalError< Object * > ofbx::parse (const Scene &scene, const Element &element, Allocator &allocator)
 
static OptionalError< Object * > ofbx::parseCluster (const Scene &scene, const Element &element, Allocator &allocator)
 
static OptionalError< Object * > ofbx::parseNodeAttribute (const Scene &scene, const Element &element, Allocator &allocator)
 
static OptionalError< Object * > ofbx::parseLimbNode (const Scene &scene, const Element &element, Allocator &allocator)
 
static OptionalError< Object * > ofbx::parseMesh (const Scene &scene, const Element &element, Allocator &allocator)
 
static OptionalError< Object * > ofbx::parseMaterial (const Scene &scene, const Element &element, Allocator &allocator)
 
template<typename T >
static bool ofbx::parseTextArrayRaw (const Property &property, T *out, int max_size)
 
template<typename T >
const char * ofbx::fromString (const char *str, const char *end, T *val)
 
template<>
const char * ofbx::fromString< int > (const char *str, const char *end, int *val)
 
template<>
const char * ofbx::fromString< u64 > (const char *str, const char *end, u64 *val)
 
template<>
const char * ofbx::fromString< i64 > (const char *str, const char *end, i64 *val)
 
template<>
const char * ofbx::fromString< double > (const char *str, const char *end, double *val)
 
template<>
const char * ofbx::fromString< float > (const char *str, const char *end, float *val)
 
const char * ofbx::fromString (const char *str, const char *end, double *val, int count)
 
template<>
const char * ofbx::fromString< Vec2 > (const char *str, const char *end, Vec2 *val)
 
template<>
const char * ofbx::fromString< Vec3 > (const char *str, const char *end, Vec3 *val)
 
template<>
const char * ofbx::fromString< Vec4 > (const char *str, const char *end, Vec4 *val)
 
template<>
const char * ofbx::fromString< Matrix > (const char *str, const char *end, Matrix *val)
 
template<typename T >
static void ofbx::parseTextArray (const Property &property, std::vector< T > *out)
 
template<typename T >
static bool ofbx::parseDoubleVecData (Property &property, std::vector< T > *out_vec, std::vector< float > *tmp)
 
template<typename T >
static bool ofbx::parseVertexData (const Element &element, const char *name, const char *index_name, std::vector< T > *out, std::vector< int > *out_indices, GeometryImpl::VertexDataMapping *mapping, std::vector< float > *tmp)
 
static int ofbx::decodeIndex (int idx)
 
static int ofbx::codeIndex (int idx, bool last)
 
template<typename T >
static void ofbx::splat (std::vector< T > *out, GeometryImpl::VertexDataMapping mapping, const std::vector< T > &data, const std::vector< int > &indices, const std::vector< int > &original_indices)
 
template<typename T >
static void ofbx::remap (std::vector< T > *out, const std::vector< int > &map)
 
static OptionalError< Object * > ofbx::parseAnimationCurve (const Scene &scene, const Element &element, Allocator &allocator)
 
static int ofbx::getTriCountFromPoly (const std::vector< int > &indices, int *idx)
 
static void ofbx::add (GeometryImpl::NewVertex &vtx, int index)
 
static void ofbx::triangulate (const std::vector< int > &old_indices, std::vector< int > *to_old_vertices, std::vector< int > *to_old_indices)
 
static void ofbx::buildGeometryVertexData (GeometryImpl *geom, const std::vector< Vec3 > &vertices, const std::vector< int > &original_indices, std::vector< int > &to_old_indices, bool triangulationEnabled)
 
static OptionalError< Object * > ofbx::parseGeometryMaterials (GeometryImpl *geom, const Element &element, const std::vector< int > &original_indices)
 
static OptionalError< Object * > ofbx::parseGeometryUVs (GeometryImpl *geom, const Element &element, const std::vector< int > &original_indices, const std::vector< int > &to_old_indices, Temporaries *tmp)
 
static OptionalError< Object * > ofbx::parseGeometryTangents (GeometryImpl *geom, const Element &element, const std::vector< int > &original_indices, const std::vector< int > &to_old_indices, Temporaries *tmp)
 
static OptionalError< Object * > ofbx::parseGeometryColors (GeometryImpl *geom, const Element &element, const std::vector< int > &original_indices, const std::vector< int > &to_old_indices, Temporaries *tmp)
 
static OptionalError< Object * > ofbx::parseGeometryNormals (GeometryImpl *geom, const Element &element, const std::vector< int > &original_indices, const std::vector< int > &to_old_indices, Temporaries *tmp)
 
static OptionalError< Object * > ofbx::parseGeometry (const Element &element, bool triangulate, GeometryImpl *geom)
 
static bool ofbx::isString (const Property *prop)
 
static bool ofbx::isLong (const Property *prop)
 
static bool ofbx::parseConnections (const Element &root, Scene *scene)
 
static bool ofbx::parseTakes (Scene *scene)
 
static float ofbx::getFramerateFromTimeMode (FrameRate time_mode, float custom_frame_rate)
 
static void ofbx::parseGlobalSettings (const Element &root, Scene *scene)
 
void ofbx::sync_job_processor (JobFunction fn, void *, void *data, u32 size, u32 count)
 
static bool ofbx::parseObjects (const Element &root, Scene *scene, u64 flags, Allocator &allocator, JobProcessor job_processor, void *job_user_ptr)
 
IScene * ofbx::load (const u8 *data, int size, u64 flags, JobProcessor job_processor, void *job_user_ptr)
 
const char * ofbx::getError ()
 

Macro Definition Documentation

◆ get_property

#define get_property (   name,
  field,
  type,
  getter 
)
Value:
if(node->first_property->value == name) \
{ \
IElementProperty* prop = node->getProperty(4); \
if (prop) \
{ \
DataView value = prop->getValue(); \
scene->m_settings.field = (type)value.getter(); \
} \
}

◆ get_time_property

#define get_time_property (   name,
  field,
  type,
  getter 
)
Value:
if(node->first_property->value == name) \
{ \
IElementProperty* prop = node->getProperty(4); \
if (prop) \
{ \
DataView value = prop->getValue(); \
scene->m_settings.field = fbxTimeToSeconds((type)value.getter()); \
} \
}
double fbxTimeToSeconds(i64 value)
Definition: ofbx.cpp:256