Beispiel #1
0
        static void DrawGizmosSelected(RayfireShatter shatter, GizmoType gizmoType)
        {
            // Color preview
            if (shatter.colorPreview == true)
            {
                ColorPreview(shatter);
            }

            // Custom point cloud preview
            if (shatter.type == FragType.Custom)
            {
                if (shatter.custom.enable == true)
                {
                    Gizmos.color = Color.green;

                    // Get bounds for preview
                    Bounds bound = shatter.GetBound();
                    if (bound.size.magnitude > 0)
                    {
                        List <Vector3> pointCloud = RFCustom.GetCustomPointCLoud(shatter.custom, shatter.transform, shatter.advanced.seed, bound);
                        if (pointCloud.Count > 0)
                        {
                            for (int i = 0; i < pointCloud.Count; i++)
                            {
                                Gizmos.DrawSphere(pointCloud[i], shatter.custom.size);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        // Set custom point cloud
        static void SetCustom(RFShatter shatter, RFCustom custom, Transform tm, MeshFilter mf, Bounds bound, RFSplinters splint, RFSplinters slabs, int seed)
        {
            // Set properties
            shatter.SetFragmentParameter(RFShatter.FragmentParams.type, (int)RFShatter.FragmentType.voronoi);
            shatter.SetFragmentParameter(RFShatter.FragmentParams.voronoi_type, (int)RFShatter.VoronoiType.custom);

            // Get Point Cloud
            List <Vector3> pointCloud = RFCustom.GetCustomPointCLoud(custom, tm, seed, bound);

            // Set points
            shatter.SetVoroCustomPoints(pointCloud.ToArray(), tm);

            // Set Stretching TODO point cloud rescale by transform
            // if (custom.modifier == RFCustom.RFModifierType.Splinters)
            //     SetStretching (shatter, splint.axis, splint.strength, FragType.Splinters);
            // else if (custom.modifier == RFCustom.RFModifierType.Slabs)
            //     SetStretching (shatter, slabs.axis, slabs.strength, FragType.Slabs);
        }