fix: T50412 - collada: Replaced precision local limit function by blender's own implementation

This commit is contained in:
Gaia Clary 2017-04-01 15:29:40 +02:00
parent e1fb080743
commit 3bf0026bec
Notes: blender-bot 2023-02-14 07:11:53 +01:00
Referenced by commit 8825a8e951, Squashed commit of the following:
Referenced by issue #50761, [AMDGPU-pro] Cycles troubles with opencl (CL_OUT_OF_HOST_MEMORY)
2 changed files with 6 additions and 19 deletions

View File

@ -32,9 +32,6 @@
#include "COLLADAFWMeshPrimitive.h"
#include "COLLADAFWMeshVertexData.h"
#include "collada_utils.h"
#include "ExportSettings.h"
extern "C" {
#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
@ -64,6 +61,9 @@ extern "C" {
#include "bmesh_tools.h"
}
#include "collada_utils.h"
#include "ExportSettings.h"
float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
{
if (index >= array.getValuesCount())
@ -823,24 +823,12 @@ void bc_create_restpose_mat(const ExportSettings *export_settings, Bone *bone, f
}
/*
To get rid of those lengthy float values which make the numbers unreadable.
*/
float bc_sanitize_float(float value, float precision)
{
float result = floor((value * pow(10, precision) + 0.5)) / pow(10, precision);
if (abs(result) < 1 / pow(10, precision)) {
result = 0;
}
return result;
}
/*
Make 4*4 matrices better readable
*/
void bc_sanitize_mat(float mat[4][4], float precision)
void bc_sanitize_mat(float mat[4][4], int precision)
{
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
mat[i][j] = bc_sanitize_float(mat[i][j], precision);
mat[i][j] = double_round(mat[i][j], precision);
}

View File

@ -97,8 +97,7 @@ extern bool bc_is_leaf_bone(Bone *bone);
extern EditBone *bc_get_edit_bone(bArmature * armature, char *name);
extern int bc_set_layer(int bitfield, int layer, bool enable);
extern int bc_set_layer(int bitfield, int layer);
extern float bc_sanitize_float(float value, float precision);
extern void bc_sanitize_mat(float mat[4][4], float precision);
extern void bc_sanitize_mat(float mat[4][4], int precision);
extern IDProperty *bc_get_IDProperty(Bone *bone, std::string key);
extern void bc_set_IDProperty(EditBone *ebone, const char *key, float value);