Changeset 934 for cpp/frams/model
- Timestamp:
- 05/29/20 15:18:48 (5 years ago)
- Location:
- cpp/frams/model
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/defassign-f0-SDK.h
r932 r934 25 25 vcolor.z=1.0; 26 26 } 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 void Part_MinMaxDef::defassign() 64 { 65 volume=1; 66 } 67 68 27 69 28 70 … … 121 163 122 164 165 166 123 167 void Neuro::defassign() 124 168 { … … 128 172 vis_style="neuro"; 129 173 } 174 175 130 176 131 177 -
cpp/frams/model/f0-SDK-classes.h
r932 r934 63 63 {"vg",0,1024,"green component","f 0.0 1.0 1.0",FIELD(vcolor.y),}, 64 64 {"vb",0,1024,"blue component","f 0.0 1.0 1.0",FIELD(vcolor.z),}, 65 {0,0,0,} 66 }; 67 #undef FIELDSTRUCT 68 69 70 #define FIELDSTRUCT Part_MinMaxDef 71 ParamEntry f0_part_minmaxdef_paramtab[]= 72 { 73 {"Geometry",1,1,"p" }, 74 {"f",0,0,"volume","f 0.1 10 1",FIELD(volume),}, 75 {0,0,0,} 76 }; 77 ParamEntry f0_part_minmaxdef_xtra_paramtab[]= 78 { 79 {"Extra properties",1,0,"p"}, 65 80 {0,0,0,} 66 81 }; -
cpp/frams/model/model.cpp
r915 r934 1328 1328 ////////////////////// 1329 1329 1330 class MinPart : public Part { public: MinPart() { Param par(f0_part_paramtab, this); par.setMin(); } };1331 class MaxPart : public Part { public: MaxPart() { Param par(f0_part_paramtab, this); par.setMax(); } };1330 class MinPart : public Part_MinMaxDef { public: MinPart() { Param par(f0_part_paramtab, this); par.setMin(); Param par2(f0_part_minmaxdef_paramtab, this); par2.setMin(); } }; 1331 class MaxPart : public Part_MinMaxDef { public: MaxPart() { Param par(f0_part_paramtab, this); par.setMax(); Param par2(f0_part_minmaxdef_paramtab, this); par2.setMax(); } }; 1332 1332 class MinJoint : public Joint { public: MinJoint() { Param par(f0_joint_paramtab, this); par.setMin(); } }; 1333 1333 class MaxJoint : public Joint { public: MaxJoint() { Param par(f0_joint_paramtab, this); par.setMax(); } }; … … 1335 1335 class MaxNeuro : public Neuro { public: MaxNeuro() { Param par(f0_neuro_paramtab, this); par.setMax(); } }; 1336 1336 1337 Part &Model::getMinPart() { static MinPart part; return part; }1338 Part &Model::getMaxPart() { static MaxPart part; return part; }1339 Part &Model::getDefPart() { static Partpart; return part; }1337 Part_MinMaxDef &Model::getMinPart() { static MinPart part; return part; } 1338 Part_MinMaxDef &Model::getMaxPart() { static MaxPart part; return part; } 1339 Part_MinMaxDef &Model::getDefPart() { static Part_MinMaxDef part; return part; } 1340 1340 Joint &Model::getMinJoint() { static MinJoint joint; return joint; } 1341 1341 Joint &Model::getMaxJoint() { static MaxJoint joint; return joint; } -
cpp/frams/model/modelparts.h
r932 r934 26 26 typedef UserTags<Model, void *, 5> ModelUserTags; 27 27 28 29 /// Introduced only because we can't have a forward declaration of enum in the Model class, 30 /// and we would need a forward declaration because of mutual (cyclic) dependence of declarations of Model and NeuroClass. 31 /// https://stackoverflow.com/questions/27019292/is-in-class-enum-forward-declaration-possible 32 /// Use Model::... instead of ModelEnum::... 33 class ModelEnum 34 { 35 public: 36 enum ShapeType { SHAPE_BALL_AND_STICK, SHAPE_SOLIDS, SHAPE_UNKNOWN, SHAPE_ILLEGAL }; 37 }; 38 39 28 40 /** Common base for model elements. */ 29 41 class PartBase … … 102 114 103 115 static Param &getStaticParam(); 116 }; 117 118 class Part_MinMaxDef : public Part //contains additional information for Model::getMinPart()/getMaxPart()/getDefPart() 119 { 120 public: 121 double volume; ///< Introduced to limit the range of volumes (~mass) in simulation of solids. Genetic operators should observe this min,max volume by calculating and limiting the volume of Parts based on their type and sx,sy,sz. 122 123 void defassign(); 124 Part_MinMaxDef() { defassign(); } 104 125 }; 105 126 … … 256 277 */ 257 278 int getSupportedShapeTypes() { return (int)supported_shape_types; } 279 bool isShapeTypeSupported(ModelEnum::ShapeType t) { return (1 << (int)t) & supported_shape_types; } 258 280 int *getSymbolGlyph() 259 281 { … … 511 533 }; 512 534 513 extern ParamEntry f0_part_paramtab[], f0_ joint_paramtab[], f0_nodeltajoint_paramtab[], f0_neuro_paramtab[], f0_neuroconn_paramtab[], f0_neuroitem_paramtab[];535 extern ParamEntry f0_part_paramtab[], f0_part_minmaxdef_paramtab[], f0_joint_paramtab[], f0_nodeltajoint_paramtab[], f0_neuro_paramtab[], f0_neuroconn_paramtab[], f0_neuroitem_paramtab[]; 514 536 515 537 #endif
Note: See TracChangeset
for help on using the changeset viewer.