commit 79519f4013988ba0d38a9cff498467febbdfc4ba
parent 4f9640f40316e86e1a3054293e45c9de62526a2a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 24 Mar 2016 14:11:26 +0100
Rename super<-|_| >shape in supershape
Diffstat:
3 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/src/schiff_args.c b/src/schiff_args.c
@@ -120,10 +120,10 @@ geometry_release(struct schiff_geometry* geom)
case SCHIFF_SPHERE:
param_release(&geom->data.sphere.radius);
break;
- case SCHIFF_SUPER_SHAPE:
+ case SCHIFF_SUPERSHAPE:
FOR_EACH(i, 0, 6) {
- param_release(&geom->data.super_shape.formulas[0][i]);
- param_release(&geom->data.super_shape.formulas[1][i]);
+ param_release(&geom->data.supershape.formulas[0][i]);
+ param_release(&geom->data.supershape.formulas[1][i]);
}
break;
case SCHIFF_NONE: /* Do nothing */ break;
@@ -541,7 +541,7 @@ parse_yaml_param_distribution
}
static res_T
-parse_yaml_super_shape_formula
+parse_yaml_superformula
(const char* filename,
yaml_document_t* doc,
const yaml_node_t* node,
@@ -555,7 +555,7 @@ parse_yaml_super_shape_formula
if(node->type != YAML_MAPPING_NODE) {
log_err(filename, node,
- "expecting a mapping of super-formula parameters.\n");
+ "expecting a mapping of superformula parameters.\n");
return RES_BAD_ARG;
}
@@ -573,7 +573,7 @@ parse_yaml_super_shape_formula
if(!strcmp((char*)key->data.scalar.value, STR(Param))) { \
if(mask & BIT(Param)) { \
log_err(filename, key, \
- "the "STR(Param)" super-formula parameter is already defined.\n"); \
+ "the "STR(Param)" superformula parameter is already defined.\n"); \
return RES_BAD_ARG; \
} \
mask |= BIT(Param); \
@@ -590,14 +590,14 @@ parse_yaml_super_shape_formula
PARSE_SUPER_SHAPE_PARAM(N2);
#undef PARSE_SUPER_SHAPE_PARAM
- log_err(filename, key, "unknown super-formula parameter `%s'.\n",
+ log_err(filename, key, "unknown superformula parameter `%s'.\n",
key->data.scalar.value);
return RES_BAD_ARG;
}
#define CHECK_SUPER_SHAPE_PARAM(Param) \
if(!(mask & BIT(Param))) { \
log_err(filename, node, \
- "missing the "STR(Param)" super formula parameter.\n"); \
+ "missing the "STR(Param)" superformula parameter.\n"); \
return RES_BAD_ARG; \
} (void)0
CHECK_SUPER_SHAPE_PARAM(A);
@@ -945,7 +945,7 @@ parse_yaml_sphere
}
static res_T
-parse_yaml_super_shape
+parse_yaml_supershape
(const char* filename,
yaml_document_t* doc,
const yaml_node_t* node,
@@ -965,7 +965,7 @@ parse_yaml_super_shape
ASSERT(filename && doc && node && geom && geom_proba);
if(node->type != YAML_MAPPING_NODE) {
- log_err(filename, node, "expecting a mapping of super-shape attributes.\n");
+ log_err(filename, node, "expecting a mapping of supershape attributes.\n");
return RES_BAD_ARG;
}
@@ -990,30 +990,30 @@ parse_yaml_super_shape
/* Geometry probability */
if(!strcmp((char*)key->data.scalar.value, "proba")) {
- SETUP_MASK(PROBA, "super-shape proba");
+ SETUP_MASK(PROBA, "supershape proba");
res = parse_yaml_double(filename, val, DBL_MIN, DBL_MAX, geom_proba);
/* Super shape formula0 */
} else if(!strcmp((char*)key->data.scalar.value, "formula0")) {
- SETUP_MASK(FORMULA0, "super-shape formula0");
- res = parse_yaml_super_shape_formula
- (filename, doc, val, geom->data.super_shape.formulas[0]);
+ SETUP_MASK(FORMULA0, "supershape formula0");
+ res = parse_yaml_superformula
+ (filename, doc, val, geom->data.supershape.formulas[0]);
/* Super shape formula1 */
} else if(!strcmp((char*)key->data.scalar.value, "formula1")) {
- SETUP_MASK(FORMULA1, "super-shape formula1");
- res = parse_yaml_super_shape_formula
- (filename, doc, val, geom->data.super_shape.formulas[1]);
+ SETUP_MASK(FORMULA1, "supershape formula1");
+ res = parse_yaml_superformula
+ (filename, doc, val, geom->data.supershape.formulas[1]);
/* # slices used to discretized the super shape */
} else if(!strcmp((char*)key->data.scalar.value, "slices")) {
- SETUP_MASK(SLICES, "super-shape number of slices");
+ SETUP_MASK(SLICES, "supershape number of slices");
res = parse_yaml_uint
- (filename, val, 4, 32768, &geom->data.super_shape.nslices);
+ (filename, val, 4, 32768, &geom->data.supershape.nslices);
/* Error */
} else {
- log_err(filename, key, "unknown super-shape attribute `%s'.\n",
+ log_err(filename, key, "unknown supershape attribute `%s'.\n",
key->data.scalar.value);
res = RES_BAD_ARG;
}
@@ -1035,9 +1035,9 @@ parse_yaml_super_shape
*geom_proba = 1.0;
}
if(!(mask & SLICES)) { /* Default number of slices */
- geom->data.super_shape.nslices = SCHIFF_SUPER_SHAPE_DEFAULT.nslices;
+ geom->data.supershape.nslices = SCHIFF_SUPERSHAPE_DEFAULT.nslices;
}
- geom->type = SCHIFF_SUPER_SHAPE;
+ geom->type = SCHIFF_SUPERSHAPE;
return RES_OK;
}
@@ -1070,8 +1070,8 @@ parse_yaml_geom_distrib
res = parse_yaml_cylinder(filename, doc, val, geom, proba);
} else if(!strcmp((char*)key->data.scalar.value, "sphere")) {
res = parse_yaml_sphere(filename, doc, val, geom, proba);
- } else if(!strcmp((char*)key->data.scalar.value, "super_shape")) {
- res = parse_yaml_super_shape(filename, doc, val, geom, proba);
+ } else if(!strcmp((char*)key->data.scalar.value, "supershape")) {
+ res = parse_yaml_supershape(filename, doc, val, geom, proba);
} else {
log_err(filename, key, "unknown distribution `%s'.\n",
key->data.scalar.value);
diff --git a/src/schiff_geometry.c b/src/schiff_geometry.c
@@ -49,8 +49,8 @@ struct cylinder_context {
float height;
};
-/* 3D Context of the super shape geometry */
-struct super_shape_context {
+/* 3D Context of the supershape geometry */
+struct supershape_context {
double formulas[2][6];
};
@@ -70,7 +70,7 @@ struct mesh_context {
struct ellipsoid_context ellipsoid;
struct cylinder_context cylinder;
struct sphere_context sphere;
- struct super_shape_context super_shape;
+ struct supershape_context supershape;
} data;
};
@@ -244,19 +244,19 @@ sphere_get_position(const unsigned ivert, float vertex[3], void* ctx)
}
static void
-super_shape_get_position(const unsigned ivert, float vertex[3], void* ctx)
+supershape_get_position(const unsigned ivert, float vertex[3], void* ctx)
{
struct mesh_context* mesh_ctx = ctx;
struct sin_cos angles[2];
double uv[2];
int iform;
- ASSERT(mesh_ctx && mesh_ctx->type == SCHIFF_SUPER_SHAPE);
+ ASSERT(mesh_ctx && mesh_ctx->type == SCHIFF_SUPERSHAPE);
schiff_mesh_get_polar_position(mesh_ctx->mesh, ivert, angles);
FOR_EACH(iform, 0, 2) {
double m, k, g;
- double* form = mesh_ctx->data.super_shape.formulas[iform];
+ double* form = mesh_ctx->data.supershape.formulas[iform];
m = cos(form[M] * angles[iform].angle / 4.0);
m = fabs(m) / form[A];
@@ -398,33 +398,33 @@ geometry_sample_sphere
}
static res_T
-geometry_sample_super_shape
+geometry_sample_supershape
(struct ssp_rng* rng,
const struct schiff_geometry* geom,
const struct schiff_mesh* mesh,
struct s3d_shape* shape)
{
- const struct schiff_super_shape* sshape;
+ const struct schiff_supershape* sshape;
struct mesh_context mesh_ctx;
struct s3d_vertex_data attrib;
size_t nverts, nprims;
int iform, iattr;
ASSERT(rng && geom && mesh && shape);
- ASSERT(geom->type == SCHIFF_SUPER_SHAPE);
+ ASSERT(geom->type == SCHIFF_SUPERSHAPE);
- sshape = &geom->data.super_shape;
+ sshape = &geom->data.supershape;
mesh_ctx.mesh = mesh;
- mesh_ctx.type = SCHIFF_SUPER_SHAPE;
+ mesh_ctx.type = SCHIFF_SUPERSHAPE;
FOR_EACH(iform, 0, 2) {
FOR_EACH(iattr, 0, 6) {
- mesh_ctx.data.super_shape.formulas[iform][iattr] =
+ mesh_ctx.data.supershape.formulas[iform][iattr] =
(float)eval_param(&sshape->formulas[iform][iattr], rng);
}}
attrib.usage = S3D_POSITION;
attrib.type = S3D_FLOAT3;
- attrib.get = super_shape_get_position;
+ attrib.get = supershape_get_position;
nverts = darray_uint_size_get(&mesh->vertices.polar) / 2/*#theta/phi*/;
nprims = darray_uint_size_get(&mesh->indices) / 3/*#indices*/;
@@ -462,8 +462,8 @@ geometry_sample
case SCHIFF_SPHERE:
res = geometry_sample_sphere(rng, geom, mesh, shape);
break;
- case SCHIFF_SUPER_SHAPE:
- res = geometry_sample_super_shape(rng, geom, mesh, shape);
+ case SCHIFF_SUPERSHAPE:
+ res = geometry_sample_supershape(rng, geom, mesh, shape);
break;
default: FATAL("Unreachable code.\n"); break;
}
@@ -560,9 +560,9 @@ schiff_geometry_distribution_init
res = schiff_mesh_init_sphere(&mem_default_allocator, &ctx->meshes[i],
geoms[i].data.sphere.nslices);
break;
- case SCHIFF_SUPER_SHAPE:
+ case SCHIFF_SUPERSHAPE:
res = schiff_mesh_init_sphere_polar(&mem_default_allocator,
- &ctx->meshes[i], geoms[i].data.super_shape.nslices);
+ &ctx->meshes[i], geoms[i].data.supershape.nslices);
break;
default: FATAL("Unreachable code.\n"); break;
}
diff --git a/src/schiff_geometry.h b/src/schiff_geometry.h
@@ -44,7 +44,7 @@ enum schiff_geometry_type {
SCHIFF_CYLINDER,
SCHIFF_CYLINDER_AS_SPHERE,/* The cylinder volume is controled by a sphere */
SCHIFF_SPHERE,
- SCHIFF_SUPER_SHAPE,
+ SCHIFF_SUPERSHAPE,
SCHIFF_NONE
};
@@ -90,11 +90,11 @@ static const struct schiff_cylinder SCHIFF_CYLINDER_DEFAULT =
enum { A, B, M, N0, N1, N2 }; /* Super formula arguments */
-struct schiff_super_shape {
+struct schiff_supershape {
struct schiff_param formulas[2][6];
unsigned nslices;
};
-#define SCHIFF_SUPER_SHAPE_DEFAULT__ \
+#define SCHIFF_SUPERSHAPE_DEFAULT__ \
{{{SCHIFF_PARAM_DEFAULT__, \
SCHIFF_PARAM_DEFAULT__, \
SCHIFF_PARAM_DEFAULT__, \
@@ -108,8 +108,8 @@ struct schiff_super_shape {
SCHIFF_PARAM_DEFAULT__, \
SCHIFF_PARAM_DEFAULT__}}, 64}
-static const struct schiff_super_shape SCHIFF_SUPER_SHAPE_DEFAULT =
- SCHIFF_SUPER_SHAPE_DEFAULT__;
+static const struct schiff_supershape SCHIFF_SUPERSHAPE_DEFAULT =
+ SCHIFF_SUPERSHAPE_DEFAULT__;
struct schiff_geometry {
enum schiff_geometry_type type;
@@ -117,7 +117,7 @@ struct schiff_geometry {
struct schiff_ellipsoid ellipsoid;
struct schiff_cylinder cylinder;
struct schiff_sphere sphere;
- struct schiff_super_shape super_shape;
+ struct schiff_supershape supershape;
} data;
};