summaryrefslogtreecommitdiff
path: root/modules/fbx/fbx_parser
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-10-28 15:43:36 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-10-28 15:43:36 +0200
commit3a6be64c12a3ba8edb646d5362c34de1a5fcc0bf (patch)
treee43708b20321cf07262918d1bd6fef02c70dabf9 /modules/fbx/fbx_parser
parent3b11e33a099daa0978147a7550dd84ba5dd14f35 (diff)
clang-format: Various fixes to comments alignment from `clang-format` 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
Diffstat (limited to 'modules/fbx/fbx_parser')
-rw-r--r--modules/fbx/fbx_parser/FBXBinaryTokenizer.cpp46
-rw-r--r--modules/fbx/fbx_parser/FBXCommon.h4
-rw-r--r--modules/fbx/fbx_parser/FBXDocument.h26
-rw-r--r--modules/fbx/fbx_parser/FBXImportSettings.h68
-rw-r--r--modules/fbx/fbx_parser/FBXMeshGeometry.h6
-rw-r--r--modules/fbx/fbx_parser/FBXParser.cpp7
-rw-r--r--modules/fbx/fbx_parser/FBXParser.h2
-rw-r--r--modules/fbx/fbx_parser/FBXUtil.cpp8
-rw-r--r--modules/fbx/fbx_parser/FBXUtil.h34
9 files changed, 74 insertions, 127 deletions
diff --git a/modules/fbx/fbx_parser/FBXBinaryTokenizer.cpp b/modules/fbx/fbx_parser/FBXBinaryTokenizer.cpp
index 1eee10b251..d6abcbb00a 100644
--- a/modules/fbx/fbx_parser/FBXBinaryTokenizer.cpp
+++ b/modules/fbx/fbx_parser/FBXBinaryTokenizer.cpp
@@ -82,46 +82,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
namespace FBXDocParser {
-//enum Flag
-//{
-// e_unknown_0 = 1 << 0,
-// e_unknown_1 = 1 << 1,
-// e_unknown_2 = 1 << 2,
-// e_unknown_3 = 1 << 3,
-// e_unknown_4 = 1 << 4,
-// e_unknown_5 = 1 << 5,
-// e_unknown_6 = 1 << 6,
-// e_unknown_7 = 1 << 7,
-// e_unknown_8 = 1 << 8,
-// e_unknown_9 = 1 << 9,
-// e_unknown_10 = 1 << 10,
-// e_unknown_11 = 1 << 11,
-// e_unknown_12 = 1 << 12,
-// e_unknown_13 = 1 << 13,
-// e_unknown_14 = 1 << 14,
-// e_unknown_15 = 1 << 15,
-// e_unknown_16 = 1 << 16,
-// e_unknown_17 = 1 << 17,
-// e_unknown_18 = 1 << 18,
-// e_unknown_19 = 1 << 19,
-// e_unknown_20 = 1 << 20,
-// e_unknown_21 = 1 << 21,
-// e_unknown_22 = 1 << 22,
-// e_unknown_23 = 1 << 23,
-// e_flag_field_size_64_bit = 1 << 24, // Not sure what is
-// e_unknown_25 = 1 << 25,
-// e_unknown_26 = 1 << 26,
-// e_unknown_27 = 1 << 27,
-// e_unknown_28 = 1 << 28,
-// e_unknown_29 = 1 << 29,
-// e_unknown_30 = 1 << 30,
-// e_unknown_31 = 1 << 31
-//};
-//
-//bool check_flag(uint32_t flags, Flag to_check)
-//{
-// return (flags & to_check) != 0;
-//}
// ------------------------------------------------------------------------------------------------
Token::Token(const char *sbegin, const char *send, TokenType type, size_t offset) :
sbegin(sbegin),
@@ -458,12 +418,6 @@ void TokenizeBinary(TokenList &output_tokens, const char *input, size_t length,
//TokenizeError("file is too short",0);
}
- //uint32_t offset = 0x15;
- /* const char* cursor = input + 0x15;
- const uint32_t flags = ReadWord(input, cursor, input + length);
- const uint8_t padding_0 = ReadByte(input, cursor, input + length); // unused
- const uint8_t padding_1 = ReadByte(input, cursor, input + length); // unused*/
-
if (strncmp(input, "Kaydara FBX Binary", 18)) {
TokenizeError("magic bytes not found", 0);
}
diff --git a/modules/fbx/fbx_parser/FBXCommon.h b/modules/fbx/fbx_parser/FBXCommon.h
index 641d6d351e..611bf22d3b 100644
--- a/modules/fbx/fbx_parser/FBXCommon.h
+++ b/modules/fbx/fbx_parser/FBXCommon.h
@@ -70,8 +70,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** @file FBXCommon.h
-* Some useful constants and enums for dealing with FBX files.
-*/
+ * Some useful constants and enums for dealing with FBX files.
+ */
#ifndef FBX_COMMON_H
#define FBX_COMMON_H
diff --git a/modules/fbx/fbx_parser/FBXDocument.h b/modules/fbx/fbx_parser/FBXDocument.h
index 885ff8fca4..539d633331 100644
--- a/modules/fbx/fbx_parser/FBXDocument.h
+++ b/modules/fbx/fbx_parser/FBXDocument.h
@@ -706,13 +706,13 @@ public:
virtual ~AnimationCurve();
/** get list of keyframe positions (time).
- * Invariant: |GetKeys()| > 0 */
+ * Invariant: |GetKeys()| > 0 */
const KeyTimeList &GetKeys() const {
return keys;
}
/** get list of keyframe values.
- * Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/
+ * Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/
const KeyValueList &GetValues() const {
return values;
}
@@ -750,8 +750,8 @@ typedef std::weak_ptr<AnimationCurveNode> AnimationCurveNodeWeakPtr;
class AnimationCurveNode : public Object {
public:
/* the optional white list specifies a list of property names for which the caller
- wants animations for. If the curve node does not match one of these, std::range_error
- will be thrown. */
+ wants animations for. If the curve node does not match one of these, std::range_error
+ will be thrown. */
AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc,
const char *const *target_prop_whitelist = nullptr, size_t whitelist_size = 0);
@@ -760,8 +760,8 @@ public:
const AnimationMap &Curves() const;
/** Object the curve is assigned to, this can be nullptr if the
- * target object has no DOM representation or could not
- * be read for other reasons.*/
+ * target object has no DOM representation or could not
+ * be read for other reasons.*/
Object *Target() const {
return target;
}
@@ -799,8 +799,8 @@ public:
virtual ~AnimationLayer();
/* the optional white list specifies a list of property names for which the caller
- wants animations for. Curves not matching this list will not be added to the
- animation layer. */
+ wants animations for. Curves not matching this list will not be added to the
+ animation layer. */
const AnimationCurveNodeList Nodes(const char *const *target_prop_whitelist = nullptr, size_t whitelist_size = 0) const;
private:
@@ -891,15 +891,15 @@ public:
virtual ~Cluster();
/** get the list of deformer weights associated with this cluster.
- * Use #GetIndices() to get the associated vertices. Both arrays
- * have the same size (and may also be empty). */
+ * Use #GetIndices() to get the associated vertices. Both arrays
+ * have the same size (and may also be empty). */
const std::vector<float> &GetWeights() const {
return weights;
}
/** get indices into the vertex data of the geometry associated
- * with this cluster. Use #GetWeights() to get the associated weights.
- * Both arrays have the same size (and may also be empty). */
+ * with this cluster. Use #GetWeights() to get the associated weights.
+ * Both arrays have the same size (and may also be empty). */
const std::vector<unsigned int> &GetIndices() const {
return indices;
}
@@ -998,7 +998,7 @@ public:
LazyObject *LazyDestinationObject() const;
/** return the name of the property the connection is attached to.
- * this is an empty string for object to object (OO) connections. */
+ * this is an empty string for object to object (OO) connections. */
const std::string &PropertyName() const {
return prop;
}
diff --git a/modules/fbx/fbx_parser/FBXImportSettings.h b/modules/fbx/fbx_parser/FBXImportSettings.h
index b016db174b..bc22386957 100644
--- a/modules/fbx/fbx_parser/FBXImportSettings.h
+++ b/modules/fbx/fbx_parser/FBXImportSettings.h
@@ -81,29 +81,29 @@ namespace FBXDocParser {
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
struct ImportSettings {
/** enable strict mode:
- * - only accept fbx 2012, 2013 files
- * - on the slightest error, give up.
- *
- * Basically, strict mode means that the fbx file will actually
- * be validated.*/
+ * - only accept fbx 2012, 2013 files
+ * - on the slightest error, give up.
+ *
+ * Basically, strict mode means that the fbx file will actually
+ * be validated.*/
bool strictMode = true;
/** specifies whether all geometry layers are read and scanned for
- * usable data channels. The FBX spec indicates that many readers
- * will only read the first channel and that this is in some way
- * the recommended way- in reality, however, it happens a lot that
- * vertex data is spread among multiple layers.*/
+ * usable data channels. The FBX spec indicates that many readers
+ * will only read the first channel and that this is in some way
+ * the recommended way- in reality, however, it happens a lot that
+ * vertex data is spread among multiple layers.*/
bool readAllLayers = true;
/** specifies whether all materials are read, or only those that
- * are referenced by at least one mesh. Reading all materials
- * may make FBX reading a lot slower since all objects
- * need to be processed.
- * This bit is ignored unless readMaterials=true.*/
+ * are referenced by at least one mesh. Reading all materials
+ * may make FBX reading a lot slower since all objects
+ * need to be processed.
+ * This bit is ignored unless readMaterials=true.*/
bool readAllMaterials = true;
/** import materials (true) or skip them and assign a default
- * material.*/
+ * material.*/
bool readMaterials = true;
/** import embedded textures?*/
@@ -116,35 +116,35 @@ struct ImportSettings {
bool readLights = true;
/** import animations (i.e. animation curves, the node
- * skeleton is always imported).*/
+ * skeleton is always imported).*/
bool readAnimations = true;
/** read bones (vertex weights and deform info).*/
bool readWeights = true;
/** preserve transformation pivots and offsets. Since these can
- * not directly be represented in assimp, additional dummy
- * nodes will be generated. Note that settings this to false
- * can make animation import a lot slower.
- *
- * The naming scheme for the generated nodes is:
- * <OriginalName>_$AssimpFbx$_<TransformName>
- *
- * where <TransformName> is one of
- * RotationPivot
- * RotationOffset
- * PreRotation
- * PostRotation
- * ScalingPivot
- * ScalingOffset
- * Translation
- * Scaling
- * Rotation
- **/
+ * not directly be represented in assimp, additional dummy
+ * nodes will be generated. Note that settings this to false
+ * can make animation import a lot slower.
+ *
+ * The naming scheme for the generated nodes is:
+ * <OriginalName>_$AssimpFbx$_<TransformName>
+ *
+ * where <TransformName> is one of
+ * RotationPivot
+ * RotationOffset
+ * PreRotation
+ * PostRotation
+ * ScalingPivot
+ * ScalingOffset
+ * Translation
+ * Scaling
+ * Rotation
+ **/
bool preservePivots = true;
/** do not import animation curves that specify a constant
- * values matching the corresponding node transformation.*/
+ * values matching the corresponding node transformation.*/
bool optimizeEmptyAnimationCurves = true;
/** use legacy naming for embedded textures eg: (*0, *1, *2).*/
diff --git a/modules/fbx/fbx_parser/FBXMeshGeometry.h b/modules/fbx/fbx_parser/FBXMeshGeometry.h
index c9b25f008d..26fc1914d1 100644
--- a/modules/fbx/fbx_parser/FBXMeshGeometry.h
+++ b/modules/fbx/fbx_parser/FBXMeshGeometry.h
@@ -226,7 +226,7 @@ public:
const std::vector<Vector3> &GetVertices() const;
/** Get a list of all vertex normals or an empty array if
- * no normals are specified. */
+ * no normals are specified. */
const std::vector<Vector3> &GetNormals() const;
/** Return list of vertex indices. */
@@ -238,8 +238,8 @@ private:
std::vector<unsigned int> m_indices;
};
/**
-* DOM class for FBX geometry of type "Line"
-*/
+ * DOM class for FBX geometry of type "Line"
+ */
class LineGeometry : public Geometry {
public:
/** The class constructor */
diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp
index d9ef025a16..dbc9a0e46d 100644
--- a/modules/fbx/fbx_parser/FBXParser.cpp
+++ b/modules/fbx/fbx_parser/FBXParser.cpp
@@ -660,13 +660,6 @@ void ParseVectorDataArray(std::vector<Vector3> &out, const ElementPtr el) {
static_cast<real_t>(d[1]),
static_cast<real_t>(d[2])));
}
- // for debugging
- /*for ( size_t i = 0; i < out.size(); i++ ) {
- aiVector3D vec3( out[ i ] );
- std::stringstream stream;
- stream << " vec3.x = " << vec3.x << " vec3.y = " << vec3.y << " vec3.z = " << vec3.z << std::endl;
- DefaultLogger::get()->info( stream.str() );
- }*/
} else if (type == 'f') {
const float *f = reinterpret_cast<const float *>(&buff[0]);
for (unsigned int i = 0; i < count3; ++i, f += 3) {
diff --git a/modules/fbx/fbx_parser/FBXParser.h b/modules/fbx/fbx_parser/FBXParser.h
index 93836c2205..27db18bf8a 100644
--- a/modules/fbx/fbx_parser/FBXParser.h
+++ b/modules/fbx/fbx_parser/FBXParser.h
@@ -187,7 +187,7 @@ private:
class Parser {
public:
/** Parse given a token list. Does not take ownership of the tokens -
- * the objects must persist during the entire parser lifetime */
+ * the objects must persist during the entire parser lifetime */
Parser(const TokenList &tokens, bool is_binary);
~Parser();
diff --git a/modules/fbx/fbx_parser/FBXUtil.cpp b/modules/fbx/fbx_parser/FBXUtil.cpp
index 1f14a69099..df46bd85c7 100644
--- a/modules/fbx/fbx_parser/FBXUtil.cpp
+++ b/modules/fbx/fbx_parser/FBXUtil.cpp
@@ -169,10 +169,10 @@ char EncodeBase64(char byte) {
}
/** Encodes a block of 4 bytes to base64 encoding
-* @param bytes Bytes to encode.
-* @param out_string String to write encoded values to.
-* @param string_pos Position in out_string.
-*/
+ * @param bytes Bytes to encode.
+ * @param out_string String to write encoded values to.
+ * @param string_pos Position in out_string.
+ */
void EncodeByteBlock(const char *bytes, std::string &out_string, size_t string_pos) {
char b0 = (bytes[0] & 0xFC) >> 2;
char b1 = (bytes[0] & 0x03) << 4 | ((bytes[1] & 0xF0) >> 4);
diff --git a/modules/fbx/fbx_parser/FBXUtil.h b/modules/fbx/fbx_parser/FBXUtil.h
index efc131831b..dab2a4201e 100644
--- a/modules/fbx/fbx_parser/FBXUtil.h
+++ b/modules/fbx/fbx_parser/FBXUtil.h
@@ -87,34 +87,34 @@ namespace Util {
const char *TokenTypeString(TokenType t);
/** Decode a single Base64-encoded character.
-*
-* @param ch Character to decode (from base64 to binary).
-* @return decoded byte value*/
+ *
+ * @param ch Character to decode (from base64 to binary).
+ * @return decoded byte value*/
uint8_t DecodeBase64(char ch);
/** Compute decoded size of a Base64-encoded string
-*
-* @param in Characters to decode.
-* @param inLength Number of characters to decode.
-* @return size of the decoded data (number of bytes)*/
+ *
+ * @param in Characters to decode.
+ * @param inLength Number of characters to decode.
+ * @return size of the decoded data (number of bytes)*/
size_t ComputeDecodedSizeBase64(const char *in, size_t inLength);
/** Decode a Base64-encoded string
-*
-* @param in Characters to decode.
-* @param inLength Number of characters to decode.
-* @param out Pointer where we will store the decoded data.
-* @param maxOutLength Size of output buffer.
-* @return size of the decoded data (number of bytes)*/
+ *
+ * @param in Characters to decode.
+ * @param inLength Number of characters to decode.
+ * @param out Pointer where we will store the decoded data.
+ * @param maxOutLength Size of output buffer.
+ * @return size of the decoded data (number of bytes)*/
size_t DecodeBase64(const char *in, size_t inLength, uint8_t *out, size_t maxOutLength);
char EncodeBase64(char byte);
/** Encode bytes in base64-encoding
-*
-* @param data Binary data to encode.
-* @param inLength Number of bytes to encode.
-* @return base64-encoded string*/
+ *
+ * @param data Binary data to encode.
+ * @param inLength Number of bytes to encode.
+ * @return base64-encoded string*/
std::string EncodeBase64(const char *data, size_t length);
} // namespace Util
} // namespace FBXDocParser