Changeset 932 for cpp/frams/model


Ignore:
Timestamp:
05/28/20 18:00:45 (4 years ago)
Author:
Maciej Komosinski
Message:

Neuron classes now have a property (a bit field) that says whether each neuron class supports model shape BALL_AND_STICK, SOLIDS, or both

Location:
cpp/frams/model
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/defassign-f0-SDK.h

    r915 r932  
    2525vcolor.z=1.0;
    2626}
     27
    2728
    2829
     
    119120
    120121
     122
    121123void Neuro::defassign()
    122124{
     
    126128vis_style="neuro";
    127129}
     130
    128131
    129132
     
    184187
    185188
     189
  • cpp/frams/model/f0-SDK-classes.h

    r920 r932  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    172172 {"Vstyle",2,0,"vis_style","s 0 0 neuro",FIELD(vis_style),},
    173173 {"getInputCount",0,1+2,"input count","d",GETONLY(inputCount),},
    174  {"getInputNeuroDef",0,1+2,"get input neuron","p oNeuroDef(d)",PROCEDURE(p_getInputNeuroDef),},
    175  {"getInputNeuroIndex",0,1+2,"get input neuron index","p d(d)",PROCEDURE(p_getInputNeuroIndex),},
    176  {"getInputWeight",0,1+2,"get input weight","p f(d)",PROCEDURE(p_getInputWeight),},
     174 {"getInputNeuroDef",0,0,"get input neuron","p oNeuroDef(d)",PROCEDURE(p_getInputNeuroDef),},
     175 {"getInputNeuroIndex",0,0,"get input neuron index","p d(d)",PROCEDURE(p_getInputNeuroIndex),},
     176 {"getInputWeight",0,0,"get input weight","p f(d)",PROCEDURE(p_getInputWeight),},
    177177 {"classObject",0,1+2,"neuron class","oNeuroClass",GETONLY(classObject),},
    178178 {0,0,0,}
  • cpp/frams/model/model.h

    r896 r932  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    9393
    9494public:
    95         enum ShapeType { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_BALL_AND_STICK, SHAPE_SOLIDS };
     95        enum ShapeType { SHAPE_BALL_AND_STICK = 0, SHAPE_SOLIDS = 1, SHAPE_UNKNOWN, SHAPE_ILLEGAL };
    9696        /// used in internalCheck()
    9797        enum CheckType {
  • cpp/frams/model/modelparts.cpp

    r926 r932  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    9898NeuroClass::NeuroClass(ParamEntry *_props, SString _description,
    9999        int _prefinputs, int _prefoutput, int _preflocation,
    100         int *_vectordata, bool own_vd, int vhints)
     100        int *_vectordata, bool own_vd, int vhints, int sup_shapes)
    101101        :ownedvectordata(own_vd),
    102102        name(_props->name), longname(_props->id), description(_description),
     
    105105        prefoutput(_prefoutput),
    106106        preflocation(_preflocation),
     107        supported_shape_types(sup_shapes),
    107108        vectordata(_vectordata),
    108109        visualhints(vhints), impl_count(0),/*impl(0),*/active(1), genactive(0)
  • cpp/frams/model/modelparts.h

    r920 r932  
    124124        class Pt3D d;           ///< position delta between parts
    125125        class Pt3D rot; ///< orientation delta between parts expressed as 3 angles
    126         enum Shape { SHAPE_BALL_AND_STICK = 0, ///<  old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with part.shape>0
    127                      SHAPE_FIXED = 1, ///< merge parts into one physical entity
    128                      SHAPE_HINGE_X = 2, ///< hinge connection, revolving around X axis defined by hinge_pos and hinge_rot
    129                      SHAPE_HINGE_XY = 3 }; ///< double hinge connection, revolving around X and Y axes defined by hinge_pos and hinge_rot
     126        enum Shape {
     127                SHAPE_BALL_AND_STICK = 0, ///<  old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with part.shape>0
     128                SHAPE_FIXED = 1, ///< merge parts into one physical entity
     129                SHAPE_HINGE_X = 2, ///< hinge connection, revolving around X axis defined by hinge_pos and hinge_rot
     130                SHAPE_HINGE_XY = 3 ///< double hinge connection, revolving around X and Y axes defined by hinge_pos and hinge_rot
     131        };
    130132        paInt shape;///< values of type Shape (paInt for integration with Param)
    131133        class Pt3D hinge_pos; ///< hinge position (relative to part1) for HINGE_X and HINGE_XY
     
    199201        paInt prefinputs, prefoutput;
    200202        paInt preflocation;
     203
     204        static constexpr int SUPPORTED_SHAPE_BALL_AND_STICK = 1;
     205        static constexpr int SUPPORTED_SHAPE_SOLIDS = 2;
     206        static constexpr int SUPPORTED_SHAPE_ALL = SUPPORTED_SHAPE_BALL_AND_STICK | SUPPORTED_SHAPE_SOLIDS;
     207        paInt supported_shape_types; //< bitfield of 'Model::shape' values: NeuroClass::SUPPORTED_SHAPE_xxx = 1 << Model::SHAPE_xxx
    201208        int *vectordata;
    202209        paInt visualhints;
     
    212219        NeuroClass();
    213220        NeuroClass(ParamEntry *_props, SString _description,
    214                 int _prefinputs, int _prefoutput, int _preflocation, int *_vectordata, bool own_vd = 1, int vhints = 0);
     221                int _prefinputs, int _prefoutput, int _preflocation, int *_vectordata, bool own_vd = 1, int vhints = 0, int sup_shapes = NeuroClass::SUPPORTED_SHAPE_ALL);
    215222        /** class name for use in Neuro::setClassName(), Neuro::setDetails() (former 'moredata' field),
    216223                eg. "N","-",G" */
     
    248255                }
    249256                */
     257        int getSupportedShapeTypes() { return (int)supported_shape_types; }
    250258        int *getSymbolGlyph()
    251259        {
Note: See TracChangeset for help on using the changeset viewer.