1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
|
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
#ifndef FRACTURE_TOOLS_STRUCTS_H
#define FRACTURE_TOOLS_STRUCTS_H
#include "foundation/Px.h"
#include "ExplicitHierarchicalMesh.h"
PX_PUSH_PACK_DEFAULT
namespace FractureTools
{
/**
These parameters are passed into the fracturing functions to guide mesh processing.
*/
struct MeshProcessingParameters
{
/**
If this is true, separate mesh islands will be turned into separate chunks.
Default = false.
*/
bool islandGeneration;
/**
If this is true, all T-junctions will be removed from the mesh.
Default = false.
*/
bool removeTJunctions;
/**
The mesh is initially scaled to fit in a unit cube, then (if gridSize is not
zero), the vertices of the scaled mesh are snapped to a grid of size 1/gridSize.
A power of two is recommended.
Default = 65536.
*/
unsigned microgridSize;
/**
Open mesh handling. Modes: Automatic, Closed, Open (see BSPOpenMode)
Closed mode assumes the mesh is closed and attempts to insert interior faces.
Open mode assumes the mesh is open and does not insert interior faces.
Automatic mode attempts to determine if the mesh is open or closed, and act accordingly.
Default is Automatic mode.
*/
nvidia::BSPOpenMode::Enum meshMode;
/**
Debug output verbosity level. The higher the number, the more messages are output.
Default = 0.
*/
int verbosity;
/** Constructor sets defaults */
MeshProcessingParameters()
{
setToDefault();
}
/** Set default values */
void setToDefault()
{
islandGeneration = false;
removeTJunctions = false;
microgridSize = 65536;
meshMode = nvidia::BSPOpenMode::Automatic;
verbosity = 0;
}
};
/**
Interface to a "cutout set," used with chippable fracturing. A cutout set is created from a bitmap. The
result is turned into cutouts which are applied to the mesh. For example, a bitmap which looks like a brick
pattern will generate a cutout for each "brick," forming the cutout set.
Each cutout is a 2D entity, meant to be projected onto various faces of a mesh. They are represented
by a set of 2D vertices, which form closed loops. More than one loop may represent a single cutout, if
the loops are forced to be convex. Otherwise, a cutout is represented by a single loop.
*/
class CutoutSet
{
public:
/** Returns the number of cutouts in the set. */
virtual uint32_t getCutoutCount() const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the number of vertices in the cutout.
*/
virtual uint32_t getCutoutVertexCount(uint32_t cutoutIndex) const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the number of loops in this cutout.
*/
virtual uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the vertex indexed by vertexIndex. (Only the X and Y coordinates are used.)
*/
virtual const physx::PxVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t vertexIndex) const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the number of vertices in the loop indexed by loopIndex.
*/
virtual uint32_t getCutoutLoopSize(uint32_t coutoutIndex, uint32_t loopIndex) const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the vertex index of the vertex indexed by vertexNum, in the loop
indexed by loopIndex.
*/
virtual uint32_t getCutoutLoopVertexIndex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const = 0;
/**
Applies to the cutout indexed by cutoutIndex:
Returns the flags of the vertex indexed by vertexNum, in the loop
indexed by loopIndex.
*/
virtual uint32_t getCutoutLoopVertexFlags(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const = 0;
/**
Whether or not this cutout set is to be tiled.
*/
virtual bool isPeriodic() const = 0;
/**
The dimensions of the fracture map used to create the cutout set.
*/
virtual const physx::PxVec2& getDimensions() const = 0;
/** Serialization */
//virtual void serialize(physx::PxFileBuf& stream) const = 0;
//virtual void deserialize(physx::PxFileBuf& stream) = 0;
/** Releases all memory and deletes itself. */
virtual void release() = 0;
protected:
/** Protected destructor. Use the release() method. */
virtual ~CutoutSet() {}
};
/**
NoiseParameters
These parameters are used to build a splitting surface.
*/
struct NoiseParameters
{
/**
Size of the fluctuations, relative to mesh size
*/
float amplitude;
/**
Noise frequencey relative to 1/(grid spacing). On scales much smaller than this, the function is smooth.
On scales much large, the function looks uncorrelated
*/
float frequency;
/**
Suggested number of grid elements across the mesh. The actual number may vary depending
on the mesh's proportions.
*/
int gridSize;
/**
Noise function to use. This parameter is currently unused.
Noise is generated by superposition of many fourier modes in random directions,
with frequencies randomly chosen in a band around the input frequency,
*/
int type;
/** Constructor sets defaults */
NoiseParameters()
{
setToDefault();
}
/**
Set default values:
amplitude = 0.0f;
frequency = 0.25f;
gridSize = 10;
type = 0;
*/
void setToDefault()
{
amplitude = 0.0f;
frequency = 0.25f;
gridSize = 10;
type = 0;
}
};
/**
SliceParameters
The slicing parameters for X, Y, and Z slicing of a mesh.
*/
struct SliceParameters
{
/**
Which axis order to slice the mesh.
This only matters if there is randomness in the slice surface.
*/
enum Order
{
XYZ,
YZX,
ZXY,
ZYX,
YXZ,
XZY,
Through
};
/** The slicing order (see the Order enum) */
unsigned order;
/** How many times to slice along each axis */
unsigned splitsPerPass[3];
/**
Variation in slice position along each axis. This is a relative quantity.
linearVariation[axis] = 0 means the slicing offsets are evenly spaced across the mesh along the axis.
linearVariation[axis] = 1 means the slicing offsets are randomly chosen in a range of width 1/(splitsPerPass[axis]+1)
times the width of the mesh along the axis.
*/
float linearVariation[3];
/**
Variation in the slice surface angle along each axis.
0 variation means the slice surfaces are axis-aligned. Otherwise, the surface normal will be varied randomly,
with angle to the axis somewhere within the given variation (in radians).
*/
float angularVariation[3];
/** The noise for each slicing direction */
NoiseParameters noise[3];
/** Constructor sets defaults */
SliceParameters()
{
setToDefault();
}
/** Sets all NoiseParameters to their defaults:
order = XYZ;
splitsPerPass[0] = splitsPerPass[1] = splitsPerPass[2] = 1;
linearVariation[0] = linearVariation[1] = linearVariation[2] = 0.1f;
angularVariation[0] = angularVariation[1] = angularVariation[2] = 20.0f*3.1415927f/180.0f;
noise[0].setToDefault();
noise[1].setToDefault();
noise[2].setToDefault();
*/
void setToDefault()
{
order = XYZ;
splitsPerPass[0] = splitsPerPass[1] = splitsPerPass[2] = 1;
linearVariation[0] = linearVariation[1] = linearVariation[2] = 0.1f;
angularVariation[0] = angularVariation[1] = angularVariation[2] = 20.0f * 3.1415927f / 180.0f;
noise[0].setToDefault();
noise[1].setToDefault();
noise[2].setToDefault();
}
};
/**
FractureSliceDesc
Descriptor for slice-mode fracturing.
*/
struct FractureSliceDesc
{
/** How many times to recurse the slicing process */
unsigned maxDepth;
/** Array of slice parameters; must be of length maxDepth */
SliceParameters* sliceParameters;
/**
If this is true, the targetProportions (see below) will be used.
*/
bool useTargetProportions;
/**
If useTargetProportions is true, the splitsPerPass values will not necessarily be used.
Instead, the closest values will be chosen at each recursion of slicing, in order to make
the pieces match the target proportions as closely as possible.
Note: the more noise there is in the slicing surfaces, the less accurate these proportions will be.
*/
float targetProportions[3];
/**
Smallest size allowed for chunks, as measured by their bounding box widths along the x, y, and z axes.
The sizes are interpreted as fractions of the unfractured mesh's bounding box width.
Chunks created by fracturing which are smaller than this limit will be removed. Note - this will leave holes at the given depth.
Default = (0,0,0), which disables this feature.
*/
float minimumChunkSize[3];
/**
Material application descriptor used for each slice axis.
*/
nvidia::FractureMaterialDesc materialDesc[3];
/**
If instanceChunks is true, corresponding chunks in different destructible actors will be instanced.
*/
bool instanceChunks;
/**
If true, slice geometry and noise will be stored in a separate displacement offset buffer.
*/
bool useDisplacementMaps;
/** Enum describing creation of displacement maps. */
enum NoiseMode
{
NoiseWavePlane = 0,
NoisePerlin2D,
NoisePerlin3D,
NoiseModeCount
};
/**
The noise mode. If displacement maps are enabled, NoisePerlin3D will be used.
*/
unsigned noiseMode;
/** Constructor sets defaults */
FractureSliceDesc()
{
setToDefault();
}
/**
Sets the default values:
maxDepth = 0;
sliceParameters = NULL;
useTargetProportions = false;
targetProportions[0..2] = 1.0f;
minimumChunkSize[0..2] = 0.0f;
materialDesc[0..2].setToDefault();
instanceChunks = false;
useDisplacementMaps = false;
noiseMode = NoiseWavePlane;
*/
void setToDefault()
{
maxDepth = 0;
sliceParameters = NULL;
useTargetProportions = false;
for (int i = 0; i < 3; ++i)
{
targetProportions[i] = 1.0f;
minimumChunkSize[i] = 0.0f;
materialDesc[i].setToDefault();
}
instanceChunks = false;
useDisplacementMaps = false;
noiseMode = NoiseWavePlane;
}
};
/**
CutoutParameters
Parameters for a single cutout direction.
*/
struct CutoutParameters
{
/**
The depth to apply cutout fracturing.
0 has a special value; it means cut all the way through
*/
float depth;
/**
Material application descriptor used for the cutout direction.
Note: The backface slice will use the U-direction and UV offset specified in each descriptor, however the cutout slices (surrounding
each cutout chunk) will ignore these fields (only using the UV scale).
*/
nvidia::FractureMaterialDesc materialDesc;
/**
Describes the characteristics of the backface cutting surface (along the various cutout directions).
If the noise is 0, the cutting surface will be a plane. Otherwise, there will be some variation,
or roughness, to the surface.
*/
NoiseParameters backfaceNoise;
/**
Describes the characteristics of the perimeter cutting surfaces (for the various cutout directions).
If the noise is 0, the cutting surface will smooth. Otherwise, there will be some variation,
or roughness, to the surface.
Note: this noise is applied only to the graphics of the cutout chunks. The chunks' collision volumes AND the chunks'
children (if fractured further) will NOT be affected by this noise.
*/
NoiseParameters edgeNoise;
/** Constructor sets defaults */
CutoutParameters()
{
setToDefault();
}
/**
Set default values:
depth = 1.0f;
backfaceNoise.setToDefault();
edgeNoise.setToDefault();
materialDesc.setToDefault();
*/
void setToDefault()
{
depth = 1.0f;
backfaceNoise.setToDefault();
materialDesc.setToDefault();
edgeNoise.setToDefault();
}
};
/**
FractureCutoutDesc
Descriptor for cutout-mode (chippable) fracturing.
*/
struct FractureCutoutDesc
{
/** Enum describing the directions to apply cutout fracturing. */
enum Directions
{
UserDefined = 0, // If no flags are set, the cutout direction is taken from userDefinedDirection
NegativeX = 1 << 0,
PositiveX = 1 << 1,
NegativeY = 1 << 2,
PositiveY = 1 << 3,
NegativeZ = 1 << 4,
PositiveZ = 1 << 5,
DirectionCount = 6
};
/** The directions to apply cutout fracturing. (See the Directions enum.) */
unsigned directions;
/**
The order in which to apply each cutout direction.
The direction in directionOrder[0] is applied first, in directionOrder[1], second, and so on.
*/
unsigned directionOrder[DirectionCount];
/** Cutout parameters used for the various pre-defined cutout directions. */
CutoutParameters cutoutParameters[DirectionCount];
/**
The cutout direction if directions = 0. When this is used, it must be have non-zero length (it will be
normalized internally), and userUVMapping must be set (this may be done with AssetAuthoring::calculateCutoutUVMapping).
*/
physx::PxVec3 userDefinedDirection;
/** The UV mapping used if directons = 0 (along with userDefinedDirection). */
physx::PxMat33 userUVMapping;
/** Cutout parameters used if user-defined (UV-based) cutout fracturing is selected by setting directions = 0 */
CutoutParameters userDefinedCutoutParameters;
/** Enum describing the instancing mode. */
enum InstancingMode
{
DoNotInstance,
InstanceCongruentChunks,
InstanceAllChunks,
InstanceModeCount
};
/**
The instancing mode.
*/
unsigned instancingMode;
/**
If tileFractureMap is true, the map will be tiled across the destructible.
*/
bool tileFractureMap;
/**
The U,V width of the fracture map when instancing chunks
*/
physx::PxVec2 uvTileSize;
/**
If true, non-convex cutouts will be split into convex ones.
*/
bool splitNonconvexRegions;
/**
Fracturing to apply to cutout chunks (if any), to break them down further.
Current options include none, slice fracturing, and voronoi fracturing.
*/
enum CutoutChunkFracturingMethod
{
DoNotFractureCutoutChunks,
SliceFractureCutoutChunks,
VoronoiFractureCutoutChunks,
CutoutChunkFracturingMethodCount
};
/**
If true, slice-mode fracturing will be applied to each cutout piece.
The cutout function must be provided with a FractureSliceDesc as well to describe
the slice parameters. These parameters, however, must be interpreted from the
point of view of the cutout direction. That is, X and Y slice parameters will be
used to slice along the cutout faces. The Z slice parameters will be used to slice
into the cutout faces.
*/
unsigned chunkFracturingMethod;
/**
If true, the backface and cutouts will be trimmed if (a) backface noise is non-zero or
(b) the collision hull is something other than the mesh convex hull ("Wrap Graphics Mesh").
Trimming is done by intersecting the face slice plane (without added noise) with the backface
and cutouts.
Default is true.
*/
bool trimFaceCollisionHulls;
/** Scale to apply to the X coordinates of the cutout set (along the various cutout directions). */
float cutoutWidthScale[DirectionCount];
/** Scale to apply to the Y coordinates of the cutout set (along the various cutout directions). */
float cutoutHeightScale[DirectionCount];
/** Offset to apply to the X coordinates of the cutout set (along the various cutout directions). */
float cutoutWidthOffset[DirectionCount];
/** Offset to apply to the Y coordinates of the cutout set (along the various cutout directions). */
float cutoutHeightOffset[DirectionCount];
/** If true, the cutout map will be flipped in the X direction (along the various cutout directions). */
bool cutoutWidthInvert[DirectionCount];
/** If true, the cutout map will be flipped in the Y direction (along the various cutout directions). */
bool cutoutHeightInvert[DirectionCount];
/** The interpreted size of the cutout map in the X direction */
float cutoutSizeX;
/** The interpreted size of the cutout map in the Y direction */
float cutoutSizeY;
/**
Threshold angle to merge (smoothe) vertex normals around cutout, in degrees.
If the exterior angle between two facets of a cutout region no more than this, the vertex normals and tangents will be
averaged at the facet interface. A value of 0 effectively disables smoothing.
Default value = 60 degrees.
*/
float facetNormalMergeThresholdAngle;
/** Constructor sets defaults */
FractureCutoutDesc()
{
setToDefault();
}
/**
Set default values:
directions = 0;
directionOrder[0..5] = {NegativeX, .., PositiveZ};
cutoutParameters[0..5].setToDefault();
userDefinedDirection= physx::PxVec3(0.0f);
userUVMapping = physx::PxMat33(physx::PxIdentity);
userDefinedCutoutParameters.setToDefault();
instancingMode = DoNotInstance;
tileFractureMap = false;
uvTileSize = (0.0f,0.0f)
cutoutParameters[0..5].setToDefault();
cutoutWidthScale[0..5] = 1.0f;
cutoutHeightScale[0..5] = 1.0f;
cutoutWidthOffset[0..5] = 0.0f;
cutoutHeightOffset[0..5] = 0.0f;
cutoutWidthInvert[0..5] = false;
cutoutHeightInvert[0..5] = false;
cutoutSizeX = 1.0f;
cutoutSizeY = 1.0f;
facetNormalMergeThresholdAngle = 60.0f;
splitNonconvexRegions = false;
chunkFracturingMethod = DoNotFractureCutoutChunks;
trimFaceCollisionHulls = true;
*/
void setToDefault()
{
directions = 0;
userDefinedDirection= physx::PxVec3(0.0f);
userUVMapping = physx::PxMat33(physx::PxIdentity);
userDefinedCutoutParameters.setToDefault();
instancingMode = DoNotInstance;
tileFractureMap = false;
uvTileSize = physx::PxVec2(0.0f);
for (uint32_t i = 0; i < DirectionCount; ++i)
{
directionOrder[i] = 1u << i;
cutoutParameters[i].setToDefault();
cutoutWidthScale[i] = 1.0f;
cutoutHeightScale[i] = 1.0f;
cutoutWidthOffset[i] = 0.0f;
cutoutHeightOffset[i] = 0.0f;
cutoutWidthInvert[i] = false;
cutoutHeightInvert[i] = false;
}
cutoutSizeX = 1.0f;
cutoutSizeY = 1.0f;
facetNormalMergeThresholdAngle = 60.0f;
splitNonconvexRegions = false;
chunkFracturingMethod = DoNotFractureCutoutChunks;
trimFaceCollisionHulls = true;
}
};
/**
FractureVoronoiDesc
Descriptor for Voronoi decomposition fracturing.
*/
struct FractureVoronoiDesc
{
/**
Number of cell sites in the sites array. Must be positive.
*/
unsigned siteCount;
/**
Array of cell sites. The length of this array is given by siteCount.
*/
const physx::PxVec3* sites;
/**
Array of chunk indices to associate with each site. If this pointer is NULL, then all sites will be used to split
all chunks relevant to the splitting operation. Otherwise, the chunkIndices array must be of length siteCount.
*/
const uint32_t* chunkIndices;
/**
Describes the characteristics of the interior surfaces.
If the noise is 0, the cutting surface will smooth. Otherwise, there will be some variation, or roughness, to the surface.
Note: this noise is applied only to the graphics of the chunks. The chunks' collision volumes AND the chunks'
children (if fractured further) will NOT be affected by this noise.
*/
NoiseParameters faceNoise;
/**
If instanceChunks is true, corresponding chunks in different destructible actors will be instanced.
*/
bool instanceChunks;
/**
If true, slice geometry and noise will be stored in a separate displacement offset buffer.
*/
bool useDisplacementMaps;
/** Enum describing creation of displacement maps. */
enum NoiseMode
{
NoiseWavePlane = 0,
NoisePerlin2D,
NoisePerlin3D,
NoiseModeCount
};
/**
The noise mode. If displacement maps are enabled, NoisePerlin3D will be used.
*/
unsigned noiseMode;
/**
Smallest size allowed for chunks, as measured by their bounding sphere diameters.
The sizes are interpreted as fractions of the unfractured mesh's bounding sphere diameter.
Chunks created by fracturing which are smaller than this limit will be removed. Note - this will leave holes at the given depth.
Default = 0, which disables this feature.
*/
float minimumChunkSize;
/**
Material application descriptor used for each slice.
Note: the U-direction and UV offset in the descriptor will be ignored - UV mapping is done in arbitrary orientation and translation on each chunk face.
*/
nvidia::FractureMaterialDesc materialDesc;
/** Constructor sets defaults */
FractureVoronoiDesc()
{
setToDefault();
}
/**
Sets the default values:
siteCount = 0;
sites = NULL;
chunkIndices = NULL;
faceNoise.setToDefault();
instanceChunks = false;
useDisplacementMaps = false;
noiseMode = NoiseWavePlane;
minimumChunkSize = 0.0f;
materialDesc.setToDefault();
*/
void setToDefault()
{
siteCount = 0;
sites = NULL;
chunkIndices = NULL;
faceNoise.setToDefault();
instanceChunks = false;
useDisplacementMaps = false;
noiseMode = NoiseWavePlane;
minimumChunkSize = 0.0f;
materialDesc.setToDefault();
}
};
} // namespace FractureTools
PX_POP_PACK
#endif // FRACTURE_TOOLS_H
|