// Constructor public RFSplinters(RFSplinters src) { axis = src.axis; amount = src.amount; strength = src.strength; centerBias = src.centerBias; }
// Set Slabs static void SetSlabs(RFShatter shatter, RFSplinters slabs, Transform tm, Vector3 centerPos, float centerBias) { // Set properties shatter.SetFragmentParameter(RFShatter.FragmentParams.type, (int)RFShatter.FragmentType.voronoi); shatter.SetFragmentParameter(RFShatter.FragmentParams.voronoi_type, (int)RFShatter.VoronoiType.irregular); shatter.SetFragmentParameter(RFShatter.FragmentParams.voronoi_irr_num, slabs.Amount); // Set center shatter.SetFragmentParameter(RFShatter.FragmentParams.voronoi_irr_bias, centerBias); shatter.SetCenterParameter(centerPos, tm, Vector3.forward); // Set Stretching for slabs SetStretching(shatter, slabs.axis, slabs.strength, FragType.Slabs); }
// Copy from void CopyFrom(RayfireShatter shatter) { type = shatter.type; voronoi = new RFVoronoi(shatter.voronoi); splinters = new RFSplinters(shatter.splinters); slabs = new RFSplinters(shatter.slabs); radial = new RFRadial(shatter.radial); custom = new RFCustom(shatter.custom); slice = new RFSlice(shatter.slice); tets = new RFTets(shatter.tets); mode = shatter.mode; material.CopyFrom(shatter.material); clusters = new RFShatterCluster(shatter.clusters); advanced = new RFShatterAdvanced(shatter.advanced); }
// 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 = 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); }