star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.fr/star-3d.git
Log | Files | Refs | README | LICENSE

commit eecfa939ac3b3a0f7be505ae3c4ec1d5417f7928
parent 16b9b763da14af674b8b58c4377ca769bab31b27
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 26 Feb 2016 15:57:46 +0100

Define new intermediate macros in static const struct definitions

Diffstat:
Msrc/s3d.h | 26++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/s3d.h b/src/s3d.h @@ -104,9 +104,10 @@ struct s3d_primitive { void* inst__; }; -static const struct s3d_primitive S3D_PRIMITIVE_NULL = { - S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, NULL, NULL -}; +#define S3D_PRIMITIVE_NULL__ {\ + S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, NULL, NULL\ +} +static const struct s3d_primitive S3D_PRIMITIVE_NULL = S3D_PRIMITIVE_NULL__; /* Helper macro that defines whether or not 2 primites are equal */ #define S3D_PRIMITIVE_EQ(Prim0, Prim1) \ @@ -136,8 +137,8 @@ struct s3d_vertex_data { }; /* Invalid vertex data */ -static const struct s3d_vertex_data S3D_VERTEX_DATA_NULL = -{ S3D_ATTRIBS_COUNT__, S3D_FLOAT, NULL }; +#define S3D_VERTEX_DATA_NULL__ { S3D_ATTRIBS_COUNT__, S3D_FLOAT, NULL } +static const struct s3d_vertex_data S3D_VERTEX_DATA_NULL = S3D_VERTEX_DATA_NULL__; /* Intersection point */ struct s3d_hit { @@ -148,13 +149,14 @@ struct s3d_hit { }; /* Constant defining a NULL intersection. Should be used to initialize a hit */ -static const struct s3d_hit S3D_HIT_NULL = -{ - { S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, NULL, NULL }, - { 0.f, 0.f, 0.f }, - { 0.f, 0.f }, - FLT_MAX -}; +#define S3D_HIT_NULL__ {\ + { S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, S3D_INVALID_ID, NULL, NULL },\ + { 0.f, 0.f, 0.f },\ + { 0.f, 0.f },\ + FLT_MAX\ +} + +static const struct s3d_hit S3D_HIT_NULL = S3D_HIT_NULL__; enum s3d_session_flag { S3D_TRACE = BIT(0),