I can see how its nice to have standalone C files which can be re-used, and in this case its not a big problem on its own but I don't think its a good precedent either. If we had 3+ files in blenlib/blenkernel which defined their own vector math functions I think it could become a maintenance problem and reduce readability across blenders own code.
In this case its not worth having mikktspace.c be its own library in extern so how about have a version maintained externally which includes blenders BLI_math functions?, the blender version can include a URL to this file so others can use it in their own projects without blender. On Tue, Feb 15, 2011 at 3:43 AM, Dalai Felinto <[email protected]> wrote: > Jumping into the discussion: > >>>"I prefer we stick to BLI_math.h defined functions." > But if the idea is to provide "standalone files which can be > redistributed into any other application ..." isn't better to keep > them Blender independent? > > 2011/2/14 Campbell Barton <[email protected]>: >> Noticed mikktspace.c defines its own math functions: >> >> typedef struct >> { >> float x, y, z; >> } SVec3; >> >> tbool veq( const SVec3 v1, const SVec3 v2 ) >> onst SVec3 vadd( const SVec3 v1, const SVec3 v2 ) >> const SVec3 vsub( const SVec3 v1, const SVec3 v2 ) >> const SVec3 vscale(const float fS, const SVec3 v) >> float LengthSquared( const SVec3 v ) >> float Length( const SVec3 v ) >> const SVec3 Normalize( const SVec3 v ) >> const float vdot( const SVec3 v1, const SVec3 v2) >> tbool NotZero(const float fX) >> tbool VNotZero(const SVec3 v) >> >> With external libs like fluid-sim or bullet, defining own types is >> un-avoidable but for blenlib or blenkernel functions I prefer we stick >> to BLI_math.h defined functions. >> >> On Mon, Feb 14, 2011 at 6:18 PM, M.G. Kishalmi <[email protected]> wrote: >>> Revision: 34852 >>> >>> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34852 >>> Author: lmg >>> Date: 2011-02-14 18:18:46 +0000 (Mon, 14 Feb 2011) >>> Log Message: >>> ----------- >>> This commit will switch blender to use tangent space generated within >>> the two files mikktspace.h and mikktspace.c. These are standalone files >>> which can be redistributed into any other application and regenerate the >>> same tangent spaces. The implementation is independent of the ordering >>> of faces and the vertex ordering of faces. >>> >>> Modified Paths: >>> -------------- >>> trunk/blender/source/blender/blenkernel/BKE_DerivedMesh.h >>> trunk/blender/source/blender/blenkernel/CMakeLists.txt >>> trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c >>> trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c >>> trunk/blender/source/blender/blenkernel/intern/customdata.c >>> trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c >>> trunk/blender/source/blender/gpu/intern/gpu_codegen.c >>> trunk/blender/source/blender/gpu/intern/gpu_material.c >>> trunk/blender/source/blender/gpu/intern/gpu_shader_material.glsl >>> trunk/blender/source/blender/gpu/intern/gpu_shader_material.glsl.c >>> trunk/blender/source/blender/gpu/intern/gpu_shader_vertex.glsl >>> trunk/blender/source/blender/gpu/intern/gpu_shader_vertex.glsl.c >>> trunk/blender/source/blender/render/extern/include/RE_shader_ext.h >>> trunk/blender/source/blender/render/intern/source/convertblender.c >>> trunk/blender/source/blender/render/intern/source/render_texture.c >>> trunk/blender/source/blender/render/intern/source/rendercore.c >>> trunk/blender/source/blender/render/intern/source/renderdatabase.c >>> trunk/blender/source/blender/render/intern/source/shadeinput.c >>> >>> Added Paths: >>> ----------- >>> trunk/blender/source/blender/blenkernel/intern/mikktspace.c >>> trunk/blender/source/blender/blenkernel/mikktspace.h >> _______________________________________________ >> Bf-committers mailing list >> [email protected] >> http://lists.blender.org/mailman/listinfo/bf-committers >> > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers > -- - Campbell _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
