Fixed typos in classnames

git-svn-id: http://svn.clifford.at/openscad/trunk@220 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim
kintel 2010-01-06 19:38:45 +00:00
parent a96752e378
commit 6fdfde289b
17 changed files with 133 additions and 83 deletions

View File

@ -90,7 +90,7 @@ Value Context::evaluate_function(QString name, const QVector<QString> &argnames,
return Value(); return Value();
} }
AbstractNode *Context::evaluate_module(const ModuleInstanciation *inst) const AbstractNode *Context::evaluate_module(const ModuleInstantiation *inst) const
{ {
if (modules_p && modules_p->contains(inst->modname)) if (modules_p && modules_p->contains(inst->modname))
return modules_p->value(inst->modname)->evaluate(this, inst); return modules_p->value(inst->modname)->evaluate(this, inst);

View File

@ -36,10 +36,10 @@ class ControlModule : public AbstractModule
public: public:
control_type_e type; control_type_e type;
ControlModule(control_type_e type) : type(type) { } ControlModule(control_type_e type) : type(type) { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
void for_eval(AbstractNode *node, int l, const QVector<QString> &call_argnames, const QVector<Value> &call_argvalues, const QVector<ModuleInstanciation*> arg_children, const Context *arg_context) void for_eval(AbstractNode *node, int l, const QVector<QString> &call_argnames, const QVector<Value> &call_argvalues, const QVector<ModuleInstantiation*> arg_children, const Context *arg_context)
{ {
if (call_argnames.size() > l) { if (call_argnames.size() > l) {
QString it_name = call_argnames[l]; QString it_name = call_argnames[l];
@ -71,7 +71,7 @@ void for_eval(AbstractNode *node, int l, const QVector<QString> &call_argnames,
for_eval(node, l+1, call_argnames, call_argvalues, arg_children, &c); for_eval(node, l+1, call_argnames, call_argvalues, arg_children, &c);
} }
} else { } else {
foreach (ModuleInstanciation *v, arg_children) { foreach (ModuleInstantiation *v, arg_children) {
AbstractNode *n = v->evaluate(arg_context); AbstractNode *n = v->evaluate(arg_context);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);
@ -79,7 +79,7 @@ void for_eval(AbstractNode *node, int l, const QVector<QString> &call_argnames,
} }
} }
AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstanciation *inst) const AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstantiation *inst) const
{ {
AbstractNode *node; AbstractNode *node;
@ -108,7 +108,7 @@ AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstanciation
if (!inst->argnames[i].isEmpty()) if (!inst->argnames[i].isEmpty())
c.set_variable(inst->argnames[i], inst->argvalues[i]); c.set_variable(inst->argnames[i], inst->argvalues[i]);
} }
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(&c); AbstractNode *n = v->evaluate(&c);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);
@ -123,7 +123,7 @@ AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstanciation
if (type == IF) if (type == IF)
{ {
if (inst->argvalues.size() > 0 && inst->argvalues[0].type == Value::BOOL && inst->argvalues[0].b) if (inst->argvalues.size() > 0 && inst->argvalues[0].type == Value::BOOL && inst->argvalues[0].b)
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);

View File

@ -34,14 +34,14 @@ class CsgModule : public AbstractModule
public: public:
csg_type_e type; csg_type_e type;
CsgModule(csg_type_e type) : type(type) { } CsgModule(csg_type_e type) : type(type) { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class CsgNode : public AbstractNode class CsgNode : public AbstractNode
{ {
public: public:
csg_type_e type; csg_type_e type;
CsgNode(const ModuleInstanciation *mi, csg_type_e type) : AbstractNode(mi), type(type) { } CsgNode(const ModuleInstantiation *mi, csg_type_e type) : AbstractNode(mi), type(type) { }
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const; virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
#endif #endif
@ -49,10 +49,10 @@ public:
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *CsgModule::evaluate(const Context*, const ModuleInstanciation *inst) const AbstractNode *CsgModule::evaluate(const Context*, const ModuleInstantiation *inst) const
{ {
CsgNode *node = new CsgNode(inst, type); CsgNode *node = new CsgNode(inst, type);
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);

View File

@ -31,7 +31,7 @@ class DxfLinearExtrudeModule : public AbstractModule
{ {
public: public:
DxfLinearExtrudeModule() { } DxfLinearExtrudeModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class DxfLinearExtrudeNode : public AbstractPolyNode class DxfLinearExtrudeNode : public AbstractPolyNode
@ -42,7 +42,7 @@ public:
double origin_x, origin_y, scale; double origin_x, origin_y, scale;
bool center, has_twist; bool center, has_twist;
QString filename, layername; QString filename, layername;
DxfLinearExtrudeNode(const ModuleInstanciation *mi) : AbstractPolyNode(mi) { DxfLinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
convexity = slices = 0; convexity = slices = 0;
fn = fs = fa = height = twist = 0; fn = fs = fa = height = twist = 0;
origin_x = origin_y = scale = 0; origin_x = origin_y = scale = 0;
@ -52,7 +52,7 @@ public:
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
DxfLinearExtrudeNode *node = new DxfLinearExtrudeNode(inst); DxfLinearExtrudeNode *node = new DxfLinearExtrudeNode(inst);
@ -107,7 +107,7 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI
} }
if (node->filename.isEmpty()) { if (node->filename.isEmpty()) {
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n) if (n)
node->children.append(n); node->children.append(n);

View File

@ -31,7 +31,7 @@ class DxfRotateExtrudeModule : public AbstractModule
{ {
public: public:
DxfRotateExtrudeModule() { } DxfRotateExtrudeModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class DxfRotateExtrudeNode : public AbstractPolyNode class DxfRotateExtrudeNode : public AbstractPolyNode
@ -41,7 +41,7 @@ public:
double fn, fs, fa; double fn, fs, fa;
double origin_x, origin_y, scale; double origin_x, origin_y, scale;
QString filename, layername; QString filename, layername;
DxfRotateExtrudeNode(const ModuleInstanciation *mi) : AbstractPolyNode(mi) { DxfRotateExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) {
convexity = 0; convexity = 0;
fn = fs = fa = 0; fn = fs = fa = 0;
origin_x = origin_y = scale = 0; origin_x = origin_y = scale = 0;
@ -50,7 +50,7 @@ public:
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
DxfRotateExtrudeNode *node = new DxfRotateExtrudeNode(inst); DxfRotateExtrudeNode *node = new DxfRotateExtrudeNode(inst);

View File

@ -123,6 +123,44 @@ static void STDCALL tess_error(GLenum errno)
PRINTF("GLU tesselation error %d!", errno); PRINTF("GLU tesselation error %d!", errno);
} }
static void STDCALL tess_begin_data()
{
PRINTF("GLU tesselation BEGIN_DATA\n");
}
static void STDCALL tess_edge_flag(GLboolean flag)
{
// PRINTF("GLU tesselation EDGE_FLAG\n");
}
static void STDCALL tess_edge_flag_data(GLboolean flag, void *polygon_data)
{
PRINTF("GLU tesselation EDGE_FLAG_DATA\n");
}
static void STDCALL tess_vertex_data(void *vertex_data, void *polygon_data)
{
PRINTF("GLU tesselation VERTEX_DATA\n");
}
static void STDCALL tess_end_data(void *polygon_data)
{
PRINTF("GLU tesselation END_DATA\n");
}
static void STDCALL tess_combine(GLdouble coords[3], void *vertex_data[4],
GLfloat weight[4], void **outData )
{
PRINTF("GLU tesselation COMBINE\n");
}
static void STDCALL tess_combine_data(GLdouble coords[3], void *vertex_data[4],
GLfloat weight[4], void **outData,
void *polygon_data)
{
PRINTF("GLU tesselation COMBINE_DATA\n");
}
static void STDCALL tess_error_data(GLenum errno, void *polygon_data )
{
PRINTF("GLU tesselation ERROR_DATA\n");
}
static bool point_on_line(double *p1, double *p2, double *p3) static bool point_on_line(double *p1, double *p2, double *p3)
{ {
if (fabs(p1[0] - p2[0]) < 0.00001 && fabs(p1[1] - p2[1]) < 0.00001) if (fabs(p1[0] - p2[0]) < 0.00001 && fabs(p1[1] - p2[1]) < 0.00001)
@ -170,6 +208,17 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, bool do_trian
gluTessCallback(tobj, GLU_TESS_END, (void(STDCALL *)())&tess_end); gluTessCallback(tobj, GLU_TESS_END, (void(STDCALL *)())&tess_end);
gluTessCallback(tobj, GLU_TESS_ERROR, (void(STDCALL *)())&tess_error); gluTessCallback(tobj, GLU_TESS_ERROR, (void(STDCALL *)())&tess_error);
gluTessCallback(tobj, GLU_TESS_EDGE_FLAG, (void(STDCALL *)())&tess_edge_flag);
gluTessCallback(tobj, GLU_TESS_COMBINE, (void(STDCALL *)())&tess_combine);
/* gluTessCallback(tobj, GLU_TESS_BEGIN_DATA, (void(STDCALL *)())&tess_begin_data); */
/* gluTessCallback(tobj, GLU_TESS_EDGE_FLAG_DATA, (void(STDCALL *)())&tess_edge_flag_data); */
/* gluTessCallback(tobj, GLU_TESS_VERTEX_DATA, (void(STDCALL *)())&tess_vertex_data); */
/* gluTessCallback(tobj, GLU_TESS_END_DATA, (void(STDCALL *)())&tess_end_data); */
/* gluTessCallback(tobj, GLU_TESS_COMBINE_DATA, (void(STDCALL *)())&tess_combine_data); */
/* gluTessCallback(tobj, GLU_TESS_ERROR_DATA, (void(STDCALL *)())&tess_error_data); */
tess_tri.clear(); tess_tri.clear();
QList<tess_vdata> vl; QList<tess_vdata> vl;
@ -204,7 +253,7 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, bool do_trian
gluTessEndPolygon(tobj); gluTessEndPolygon(tobj);
gluDeleteTess(tobj); gluDeleteTess(tobj);
#if 0 #if 1
for (int i = 0; i < tess_tri.count(); i++) { for (int i = 0; i < tess_tri.count(); i++) {
printf("~~~\n"); printf("~~~\n");
printf(" %f %f %f\n", tess_tri[i].p[0][0], tess_tri[i].p[0][1], tess_tri[i].p[0][2]); printf(" %f %f %f\n", tess_tri[i].p[0][0], tess_tri[i].p[0][1], tess_tri[i].p[0][2]);
@ -219,6 +268,7 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, bool do_trian
if (point_on_line(tess_tri[i].p[0], tess_tri[i].p[1], tess_tri[i].p[2]) || if (point_on_line(tess_tri[i].p[0], tess_tri[i].p[1], tess_tri[i].p[2]) ||
point_on_line(tess_tri[i].p[1], tess_tri[i].p[2], tess_tri[i].p[0]) || point_on_line(tess_tri[i].p[1], tess_tri[i].p[2], tess_tri[i].p[0]) ||
point_on_line(tess_tri[i].p[2], tess_tri[i].p[0], tess_tri[i].p[1])) { point_on_line(tess_tri[i].p[2], tess_tri[i].p[0], tess_tri[i].p[1])) {
printf("DEBUG: Removed triangle\n");
tess_tri.remove(i--); tess_tri.remove(i--);
} }
} }

View File

@ -38,7 +38,7 @@ class ImportModule : public AbstractModule
public: public:
import_type_e type; import_type_e type;
ImportModule(import_type_e type) : type(type) { } ImportModule(import_type_e type) : type(type) { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class ImportNode : public AbstractPolyNode class ImportNode : public AbstractPolyNode
@ -50,12 +50,12 @@ public:
int convexity; int convexity;
double fn, fs, fa; double fn, fs, fa;
double origin_x, origin_y, scale; double origin_x, origin_y, scale;
ImportNode(const ModuleInstanciation *mi, import_type_e type) : AbstractPolyNode(mi), type(type) { } ImportNode(const ModuleInstantiation *mi, import_type_e type) : AbstractPolyNode(mi), type(type) { }
virtual PolySet *render_polyset(render_mode_e mode) const; virtual PolySet *render_polyset(render_mode_e mode) const;
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
ImportNode *node = new ImportNode(inst, type); ImportNode *node = new ImportNode(inst, type);

View File

@ -519,7 +519,7 @@ void MainWindow::compile(bool procevents)
AbstractNode::idx_counter = 1; AbstractNode::idx_counter = 1;
{ {
ModuleInstanciation root_inst; ModuleInstantiation root_inst;
absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); absolute_root_node = root_module->evaluate(&root_ctx, &root_inst);
} }

View File

@ -27,11 +27,11 @@ AbstractModule::~AbstractModule()
{ {
} }
AbstractNode *AbstractModule::evaluate(const Context*, const ModuleInstanciation *inst) const AbstractNode *AbstractModule::evaluate(const Context*, const ModuleInstantiation *inst) const
{ {
AbstractNode *node = new AbstractNode(inst); AbstractNode *node = new AbstractNode(inst);
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n) if (n)
node->children.append(n); node->children.append(n);
@ -45,15 +45,15 @@ QString AbstractModule::dump(QString indent, QString name) const
return QString("%1abstract module %2();\n").arg(indent, name); return QString("%1abstract module %2();\n").arg(indent, name);
} }
ModuleInstanciation::~ModuleInstanciation() ModuleInstantiation::~ModuleInstantiation()
{ {
foreach (Expression *v, argexpr) foreach (Expression *v, argexpr)
delete v; delete v;
foreach (ModuleInstanciation *v, children) foreach (ModuleInstantiation *v, children)
delete v; delete v;
} }
QString ModuleInstanciation::dump(QString indent) const QString ModuleInstantiation::dump(QString indent) const
{ {
QString text = indent; QString text = indent;
if (!label.isEmpty()) if (!label.isEmpty())
@ -81,13 +81,13 @@ QString ModuleInstanciation::dump(QString indent) const
return text; return text;
} }
AbstractNode *ModuleInstanciation::evaluate(const Context *ctx) const AbstractNode *ModuleInstantiation::evaluate(const Context *ctx) const
{ {
AbstractNode *node = NULL; AbstractNode *node = NULL;
if (this->ctx) { if (this->ctx) {
PRINTA("WARNING: Ignoring recursive module instanciation of '%1'.", modname); PRINTA("WARNING: Ignoring recursive module instanciation of '%1'.", modname);
} else { } else {
ModuleInstanciation *that = (ModuleInstanciation*)this; ModuleInstantiation *that = (ModuleInstantiation*)this;
that->argvalues.clear(); that->argvalues.clear();
foreach (Expression *v, that->argexpr) { foreach (Expression *v, that->argexpr) {
that->argvalues.append(v->evaluate(ctx)); that->argvalues.append(v->evaluate(ctx));
@ -108,11 +108,11 @@ Module::~Module()
delete v; delete v;
foreach (AbstractModule *v, modules) foreach (AbstractModule *v, modules)
delete v; delete v;
foreach (ModuleInstanciation *v, children) foreach (ModuleInstantiation *v, children)
delete v; delete v;
} }
AbstractNode *Module::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *Module::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
Context c(ctx); Context c(ctx);
c.args(argnames, argexpr, inst->argnames, inst->argvalues); c.args(argnames, argexpr, inst->argnames, inst->argvalues);
@ -131,7 +131,7 @@ AbstractNode *Module::evaluate(const Context *ctx, const ModuleInstanciation *in
node->children.append(n); node->children.append(n);
} }
foreach(ModuleInstanciation *v, inst->children) { foreach(ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);
@ -207,7 +207,7 @@ void destroy_builtin_modules()
int AbstractNode::idx_counter; int AbstractNode::idx_counter;
AbstractNode::AbstractNode(const ModuleInstanciation *mi) AbstractNode::AbstractNode(const ModuleInstantiation *mi)
{ {
modinst = mi; modinst = mi;
idx = idx_counter++; idx = idx_counter++;

View File

@ -163,7 +163,7 @@ int main(int argc, char **argv)
root_ctx.set_variable("$vpr", zero3); root_ctx.set_variable("$vpr", zero3);
AbstractModule *root_module; AbstractModule *root_module;
ModuleInstanciation root_inst; ModuleInstantiation root_inst;
AbstractNode *root_node; AbstractNode *root_node;
handle_dep(filename); handle_dep(filename);

View File

@ -58,7 +58,7 @@ class BuiltinFunction;
class Function; class Function;
class AbstractModule; class AbstractModule;
class ModuleInstanciation; class ModuleInstantiation;
class Module; class Module;
class Context; class Context;
@ -327,11 +327,11 @@ class AbstractModule
{ {
public: public:
virtual ~AbstractModule(); virtual ~AbstractModule();
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
virtual QString dump(QString indent, QString name) const; virtual QString dump(QString indent, QString name) const;
}; };
class ModuleInstanciation class ModuleInstantiation
{ {
public: public:
QString label; QString label;
@ -339,15 +339,15 @@ public:
QVector<QString> argnames; QVector<QString> argnames;
QVector<Expression*> argexpr; QVector<Expression*> argexpr;
QVector<Value> argvalues; QVector<Value> argvalues;
QVector<ModuleInstanciation*> children; QVector<ModuleInstantiation*> children;
bool tag_root; bool tag_root;
bool tag_highlight; bool tag_highlight;
bool tag_background; bool tag_background;
const Context *ctx; const Context *ctx;
ModuleInstanciation() : tag_root(false), tag_highlight(false), tag_background(false), ctx(NULL) { } ModuleInstantiation() : tag_root(false), tag_highlight(false), tag_background(false), ctx(NULL) { }
~ModuleInstanciation(); ~ModuleInstantiation();
QString dump(QString indent) const; QString dump(QString indent) const;
AbstractNode *evaluate(const Context *ctx) const; AbstractNode *evaluate(const Context *ctx) const;
@ -365,12 +365,12 @@ public:
QHash<QString, AbstractFunction*> functions; QHash<QString, AbstractFunction*> functions;
QHash<QString, AbstractModule*> modules; QHash<QString, AbstractModule*> modules;
QVector<ModuleInstanciation*> children; QVector<ModuleInstantiation*> children;
Module() { } Module() { }
virtual ~Module(); virtual ~Module();
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
virtual QString dump(QString indent, QString name) const; virtual QString dump(QString indent, QString name) const;
}; };
@ -408,7 +408,7 @@ public:
Value lookup_variable(QString name, bool silent = false) const; Value lookup_variable(QString name, bool silent = false) const;
Value evaluate_function(QString name, const QVector<QString> &argnames, const QVector<Value> &argvalues) const; Value evaluate_function(QString name, const QVector<QString> &argnames, const QVector<Value> &argvalues) const;
AbstractNode *evaluate_module(const ModuleInstanciation *inst) const; AbstractNode *evaluate_module(const ModuleInstantiation *inst) const;
}; };
class DxfData class DxfData
@ -627,7 +627,7 @@ class AbstractNode
{ {
public: public:
QVector<AbstractNode*> children; QVector<AbstractNode*> children;
const ModuleInstanciation *modinst; const ModuleInstantiation *modinst;
int progress_mark; int progress_mark;
void progress_prepare(); void progress_prepare();
@ -637,7 +637,7 @@ public:
static int idx_counter; static int idx_counter;
QString dump_cache; QString dump_cache;
AbstractNode(const ModuleInstanciation *mi); AbstractNode(const ModuleInstantiation *mi);
virtual ~AbstractNode(); virtual ~AbstractNode();
virtual QString mk_cache_id() const; virtual QString mk_cache_id() const;
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
@ -656,7 +656,7 @@ public:
class AbstractIntersectionNode : public AbstractNode class AbstractIntersectionNode : public AbstractNode
{ {
public: public:
AbstractIntersectionNode(const ModuleInstanciation *mi) : AbstractNode(mi) { }; AbstractIntersectionNode(const ModuleInstantiation *mi) : AbstractNode(mi) { };
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const; virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
#endif #endif
@ -671,13 +671,13 @@ public:
RENDER_CGAL, RENDER_CGAL,
RENDER_OPENCSG RENDER_OPENCSG
}; };
AbstractPolyNode(const ModuleInstanciation *mi) : AbstractNode(mi) { }; AbstractPolyNode(const ModuleInstantiation *mi) : AbstractNode(mi) { };
virtual PolySet *render_polyset(render_mode_e mode) const; virtual PolySet *render_polyset(render_mode_e mode) const;
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const; virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
#endif #endif
virtual CSGTerm *render_csg_term(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background) const; virtual CSGTerm *render_csg_term(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background) const;
static CSGTerm *render_csg_term_from_ps(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background, PolySet *ps, const ModuleInstanciation *modinst, int idx); static CSGTerm *render_csg_term_from_ps(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background, PolySet *ps, const ModuleInstantiation *modinst, int idx);
}; };
extern int progress_report_count; extern int progress_report_count;

View File

@ -53,7 +53,7 @@ public:
double number; double number;
class Value *value; class Value *value;
class Expression *expr; class Expression *expr;
class ModuleInstanciation *inst; class ModuleInstantiation *inst;
class ArgContainer *arg; class ArgContainer *arg;
class ArgsContainer *args; class ArgsContainer *args;
} }
@ -84,9 +84,9 @@ public:
%type <expr> expr %type <expr> expr
%type <expr> vector_expr %type <expr> vector_expr
%type <inst> module_instantciation %type <inst> module_instantiation
%type <inst> module_instantciation_list %type <inst> module_instantiation_list
%type <inst> single_module_instantciation %type <inst> single_module_instantiation
%type <args> arguments_call %type <args> arguments_call
%type <args> arguments_decl %type <args> arguments_decl
@ -105,7 +105,7 @@ input:
statement: statement:
';' | ';' |
'{' input '}' | '{' input '}' |
module_instantciation { module_instantiation {
if ($1) { if ($1) {
module->children.append($1); module->children.append($1);
} else { } else {
@ -150,11 +150,11 @@ statement:
delete $4; delete $4;
} ';' ; } ';' ;
module_instantciation: module_instantiation:
single_module_instantciation ';' { single_module_instantiation ';' {
$$ = $1; $$ = $1;
} | } |
single_module_instantciation '{' module_instantciation_list '}' { single_module_instantiation '{' module_instantiation_list '}' {
$$ = $1; $$ = $1;
if ($$) { if ($$) {
$$->children = $3->children; $$->children = $3->children;
@ -165,7 +165,7 @@ module_instantciation:
$3->children.clear(); $3->children.clear();
delete $3; delete $3;
} | } |
single_module_instantciation module_instantciation { single_module_instantiation module_instantiation {
$$ = $1; $$ = $1;
if ($$) { if ($$) {
if ($2) if ($2)
@ -175,11 +175,11 @@ module_instantciation:
} }
} ; } ;
module_instantciation_list: module_instantiation_list:
/* empty */ { /* empty */ {
$$ = new ModuleInstanciation(); $$ = new ModuleInstantiation();
} | } |
module_instantciation_list module_instantciation { module_instantiation_list module_instantiation {
$$ = $1; $$ = $1;
if ($$) { if ($$) {
if ($2) if ($2)
@ -189,37 +189,37 @@ module_instantciation_list:
} }
} ; } ;
single_module_instantciation: single_module_instantiation:
TOK_ID '(' arguments_call ')' { TOK_ID '(' arguments_call ')' {
$$ = new ModuleInstanciation(); $$ = new ModuleInstantiation();
$$->modname = QString($1); $$->modname = QString($1);
$$->argnames = $3->argnames; $$->argnames = $3->argnames;
$$->argexpr = $3->argexpr; $$->argexpr = $3->argexpr;
free($1); free($1);
delete $3; delete $3;
} | } |
TOK_ID ':' single_module_instantciation { TOK_ID ':' single_module_instantiation {
$$ = $3; $$ = $3;
if ($$) if ($$)
$$->label = QString($1); $$->label = QString($1);
free($1); free($1);
} | } |
'!' single_module_instantciation { '!' single_module_instantiation {
$$ = $2; $$ = $2;
if ($$) if ($$)
$$->tag_root = true; $$->tag_root = true;
} | } |
'#' single_module_instantciation { '#' single_module_instantiation {
$$ = $2; $$ = $2;
if ($$) if ($$)
$$->tag_highlight = true; $$->tag_highlight = true;
} | } |
'%' single_module_instantciation { '%' single_module_instantiation {
$$ = $2; $$ = $2;
if ($$) if ($$)
$$->tag_background = true; $$->tag_background = true;
} | } |
'*' single_module_instantciation { '*' single_module_instantiation {
delete $2; delete $2;
$$ = NULL; $$ = NULL;
}; };

View File

@ -454,7 +454,7 @@ CSGTerm *AbstractPolyNode::render_csg_term(double m[16], QVector<CSGTerm*> *high
return render_csg_term_from_ps(m, highlights, background, ps, modinst, idx); return render_csg_term_from_ps(m, highlights, background, ps, modinst, idx);
} }
CSGTerm *AbstractPolyNode::render_csg_term_from_ps(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background, PolySet *ps, const ModuleInstanciation *modinst, int idx) CSGTerm *AbstractPolyNode::render_csg_term_from_ps(double m[16], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background, PolySet *ps, const ModuleInstantiation *modinst, int idx)
{ {
CSGTerm *t = new CSGTerm(ps, m, QString("n%1").arg(idx)); CSGTerm *t = new CSGTerm(ps, m, QString("n%1").arg(idx));
if (modinst->tag_highlight && highlights) if (modinst->tag_highlight && highlights)

View File

@ -36,7 +36,7 @@ class PrimitiveModule : public AbstractModule
public: public:
primitive_type_e type; primitive_type_e type;
PrimitiveModule(primitive_type_e type) : type(type) { } PrimitiveModule(primitive_type_e type) : type(type) { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class PrimitiveNode : public AbstractPolyNode class PrimitiveNode : public AbstractPolyNode
@ -47,12 +47,12 @@ public:
double fn, fs, fa; double fn, fs, fa;
primitive_type_e type; primitive_type_e type;
Value points, triangles; Value points, triangles;
PrimitiveNode(const ModuleInstanciation *mi, primitive_type_e type) : AbstractPolyNode(mi), type(type) { } PrimitiveNode(const ModuleInstantiation *mi, primitive_type_e type) : AbstractPolyNode(mi), type(type) { }
virtual PolySet *render_polyset(render_mode_e mode) const; virtual PolySet *render_polyset(render_mode_e mode) const;
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
PrimitiveNode *node = new PrimitiveNode(inst, type); PrimitiveNode *node = new PrimitiveNode(inst, type);

View File

@ -31,14 +31,14 @@ class RenderModule : public AbstractModule
{ {
public: public:
RenderModule() { } RenderModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class RenderNode : public AbstractNode class RenderNode : public AbstractNode
{ {
public: public:
int convexity; int convexity;
RenderNode(const ModuleInstanciation *mi) : AbstractNode(mi), convexity(1) { } RenderNode(const ModuleInstantiation *mi) : AbstractNode(mi), convexity(1) { }
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const; virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
#endif #endif
@ -46,7 +46,7 @@ public:
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *RenderModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *RenderModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
RenderNode *node = new RenderNode(inst); RenderNode *node = new RenderNode(inst);
@ -60,7 +60,7 @@ AbstractNode *RenderModule::evaluate(const Context *ctx, const ModuleInstanciati
if (v.type == Value::NUMBER) if (v.type == Value::NUMBER)
node->convexity = (int)v.num; node->convexity = (int)v.num;
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);

View File

@ -29,7 +29,7 @@ class SurfaceModule : public AbstractModule
{ {
public: public:
SurfaceModule() { } SurfaceModule() { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class SurfaceNode : public AbstractPolyNode class SurfaceNode : public AbstractPolyNode
@ -38,12 +38,12 @@ public:
QString filename; QString filename;
bool center; bool center;
int convexity; int convexity;
SurfaceNode(const ModuleInstanciation *mi) : AbstractPolyNode(mi) { } SurfaceNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { }
virtual PolySet *render_polyset(render_mode_e mode) const; virtual PolySet *render_polyset(render_mode_e mode) const;
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *SurfaceModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *SurfaceModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
SurfaceNode *node = new SurfaceNode(inst); SurfaceNode *node = new SurfaceNode(inst);
node->center = false; node->center = false;

View File

@ -35,14 +35,14 @@ class TransformModule : public AbstractModule
public: public:
transform_type_e type; transform_type_e type;
TransformModule(transform_type_e type) : type(type) { } TransformModule(transform_type_e type) : type(type) { }
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstanciation *inst) const; virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
}; };
class TransformNode : public AbstractNode class TransformNode : public AbstractNode
{ {
public: public:
double m[16]; double m[16];
TransformNode(const ModuleInstanciation *mi) : AbstractNode(mi) { } TransformNode(const ModuleInstantiation *mi) : AbstractNode(mi) { }
#ifdef ENABLE_CGAL #ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const; virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
#endif #endif
@ -50,7 +50,7 @@ public:
virtual QString dump(QString indent) const; virtual QString dump(QString indent) const;
}; };
AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanciation *inst) const AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{ {
TransformNode *node = new TransformNode(inst); TransformNode *node = new TransformNode(inst);
@ -174,7 +174,7 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanci
} }
} }
foreach (ModuleInstanciation *v, inst->children) { foreach (ModuleInstantiation *v, inst->children) {
AbstractNode *n = v->evaluate(inst->ctx); AbstractNode *n = v->evaluate(inst->ctx);
if (n != NULL) if (n != NULL)
node->children.append(n); node->children.append(n);