Example #1
0
        public static SceneObject BuildEnclosedPatchSO(SOFactory factory, FScene scene, TypedAttribSet attributes)
        {
            EnclosedPatchSO so = new EnclosedPatchSO();

            so.Create(scene.DefaultCurveSOMaterial);
            factory.RestorePolyCurveSOType(scene, attributes, so);
            return(so);
        }
        public override PolyCurveSO Create(SOMaterial defaultMaterial)
        {
            EnclosedPatchSO so = (EnclosedPatchSO)base.Create(defaultMaterial);

            previewMaterial = MaterialUtil.CreateTransparentMaterialF(Colorf.ForestGreen, 0.1f);

            return(so);
        }
Example #3
0
 public IVectorDisplacementSourceOp AppendRegionOp(EnclosedPatchSO Source, LegDeformationTypes type)
 {
     if (type == LegDeformationTypes.Offset)
     {
         return(AppendRegionOffset(Source));
     }
     else if (type == LegDeformationTypes.Smooth)
     {
         return(AppendRegionSmoothOp(Source));
     }
     throw new NotImplementedException("LegModel.AppendRegionOp");
 }
Example #4
0
        public static bool EmitEnclosedPatchSO(SceneSerializer s, IOutputStream o, SceneObject gso)
        {
            EnclosedPatchSO so = gso as EnclosedPatchSO;

            if (so == null)
            {
                throw new Exception("EmitEnclosedPatchSO: input so is not an EnclosedPatchSO!");
            }

            o.AddAttribute(IOStrings.ASOType, so.Type.identifier);
            SceneSerializerEmitTypesExt.EmitPolyCurveSO(s, o, so as PolyCurveSO);
            return(true);
        }
Example #5
0
        public IVectorDisplacementSourceOp AppendRegionSmoothOp(EnclosedPatchSO Source)
        {
            PolyCurveSOSourceOp    curveOp  = new PolyCurveSOSourceOp(Source);
            EnclosedRegionSmoothOp deformOp = new EnclosedRegionSmoothOp()
            {
                SmoothAlpha = 0.5f,
                MeshSource  = SOMeshSource,
                CurveSource = curveOp
            };

            Combiner.Append(deformOp);
            SO_Op.Add(Source, deformOp);

            OnDeformationAdded?.Invoke(Source, deformOp);

            return(deformOp);
        }
Example #6
0
        public IVectorDisplacementSourceOp AppendRegionOffset(EnclosedPatchSO Source)
        {
            Frame3f deformF = Frame3f.Identity;

            deformF = SceneTransforms.TransformTo(deformF, Source, leg);

            PolyCurveSOSourceOp    curveOp  = new PolyCurveSOSourceOp(Source);
            EnclosedRegionOffsetOp deformOp = new EnclosedRegionOffsetOp()
            {
                Normal           = deformF.Y,
                PushPullDistance = 2.0f,
                MeshSource       = SOMeshSource,
                CurveSource      = curveOp
            };

            Combiner.Append(deformOp);
            SO_Op.Add(Source, deformOp);

            OnDeformationAdded?.Invoke(Source, deformOp);

            return(deformOp);
        }
        public static EnclosedPatchSO CreateFromPreview(CurvePreview preview, SOMaterial material, FScene scene)
        {
            EnclosedPatchSO curveSO = (EnclosedPatchSO)preview.BuildSO(
                (curve) => {
                EnclosedPatchSO so = new EnclosedPatchSO()
                {
                    Curve = curve
                };
                so.Create(material);
                return(so);
            }, material, 1.0f);


            scene.History.PushChange(
                new AddSOChange()
            {
                scene = scene, so = curveSO, bKeepWorldPosition = false
            });
            scene.History.PushInteractionCheckpoint();

            return(curveSO);
        }