Example #1
0
        public LegModel(LegSO legIn, SOMaterial rectifiedMaterial) : base(legIn.Mesh, false, legIn.Spatial)
        {
            leg      = legIn;
            leg.Name = "InitialLeg";

            legIn.OnMeshModified += on_leg_scan_modified;

            rectified_leg = leg.DuplicateSubtype <RectifiedLegSO>();
            rectified_leg.EnableSpatial = false;
            leg.GetScene().AddSceneObject(rectified_leg, false);
            rectified_leg.AssignSOMaterial(rectifiedMaterial);
            rectified_leg.Name = "RectifiedLeg";

            //SOMeshSource = new ConstantMeshSourceOp(legIn.Mesh, true, false);
            SOMeshSource = new ConstantMeshSourceOp();

            SO_Op          = new UniquePairSet <SceneObject, ModelingOperator>();
            Combiner       = new DisplacementCombinerOp();
            VertexDisplace = new MeshVertexDisplacementOp()
            {
                MeshSource         = SOMeshSource,
                DisplacementSource = Combiner
            };
            PostScale = new MeshScaleOp()
            {
                MeshSource = VertexDisplace
            };
            Compute = new ThreadedMeshComputeOp()
            {
                MeshSource = PostScale
            };

            // add global brush layer
            BrushLayer = new VectorDisplacementMapOp()
            {
                MeshSource = SOMeshSource
            };
            Combiner.Append(BrushLayer);


            SOMeshSource.SetMesh(legIn.Mesh, true, false);
        }
        public SocketModel(SocketSO Socket, LegModel leg, TrimLoopSO trimLineIn, ModelModes eMode) : base(Socket.Mesh, false)
        {
            socket = Socket;

            this.leg = leg;
            leg.SO.OnTransformModified += leg_transform_modified;

            this.trimLine = trimLineIn;

            LegSourceOp      = new ShapeModelOutputMeshSourceOp(leg);
            TrimlineSourceOp = new PolyCurveSOSourceOp(this.trimLine);

            if (eMode == ModelModes.Socket)
            {
                DeviceGenOp = new SocketGeneratorOp();
            }
            else
            {
                DeviceGenOp = new AFOGeneratorOp();
            }

            DeviceGenOp.MeshSource               = LegSourceOp;
            DeviceGenOp.CurveSource              = TrimlineSourceOp;
            DeviceGenOp.SocketVertexColor        = Colorf.CornflowerBlue;
            DeviceGenOp.PartialSocketVertexColor = ColorMixer.Darken(Colorf.SelectionGold, 0.75f);
            DeviceGenOp.SocketThickness          = this.SocketThickness;
            DeviceGenOp.InnerWallOffset          = this.SocketOffset;
            DeviceGenOp.ConnectorCutHeight       = this.ConnectorCutHeight;

            Compute = new ThreadedMeshComputeOp()
            {
                MeshSource = DeviceGenOp
            };

            // initialize socket input transform
            leg_transform_modified(leg.SO);
        }