Jolt Physics
A multi core friendly Game Physics Engine
|
Base class for shapes that decorate another shape with extra functionality (e.g. scale, translation etc.) More...
#include <DecoratedShape.h>
Protected Attributes | |
RefConst< Shape > | mInnerShape |
Protected Attributes inherited from RefTarget< Shape > | |
atomic< uint32 > | mRefCount |
Current reference count. | |
Additional Inherited Members | |
Public Types inherited from Shape | |
using | ShapeResult = ShapeSettings::ShapeResult |
using | SupportingFace = StaticArray<Vec3, 32> |
Type definition for a supporting face. | |
using | VisitedShapes = UnorderedSet<const Shape *> |
using | ShapeToIDMap = StreamUtils::ObjectToIDMap<Shape> |
using | IDToShapeMap = StreamUtils::IDToObjectMap<Shape> |
using | MaterialToIDMap = StreamUtils::ObjectToIDMap<PhysicsMaterial> |
using | IDToMaterialMap = StreamUtils::IDToObjectMap<PhysicsMaterial> |
Static Public Member Functions inherited from Shape | |
static ShapeResult | sRestoreFromBinaryState (StreamIn &inStream) |
Creates a Shape of the correct type and restores its contents from the binary stream inStream. | |
static ShapeResult | sRestoreWithChildren (StreamIn &inStream, IDToShapeMap &ioShapeMap, IDToMaterialMap &ioMaterialMap) |
Restore a shape, all its children and materials. Pass in an empty map in ioShapeMap / ioMaterialMap or reuse the same map while reading multiple shapes from the same stream in order to restore duplicates. | |
Static Public Member Functions inherited from RefTarget< Shape > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. | |
Static Public Attributes inherited from Shape | |
static constexpr int | cGetTrianglesMinTrianglesRequested = 32 |
This is the minimum amount of triangles that should be requested through GetTrianglesNext. | |
static bool | sDrawSubmergedVolumes = false |
Debug helper which draws the intersection between water and the shapes, the center of buoyancy and the submerged volume. | |
Protected Member Functions inherited from Shape | |
virtual void | RestoreBinaryState (StreamIn &inStream) |
This function should not be called directly, it is used by sRestoreFromBinaryState. | |
Static Protected Member Functions inherited from Shape | |
static void | sCollidePointUsingRayCast (const Shape &inShape, Vec3Arg inPoint, const SubShapeIDCreator &inSubShapeIDCreator, CollidePointCollector &ioCollector, const ShapeFilter &inShapeFilter) |
A fallback version of CollidePoint that uses a ray cast and counts the number of hits to determine if the point is inside the shape. Odd number of hits means inside, even number of hits means outside. | |
Static Protected Attributes inherited from RefTarget< Shape > | |
static constexpr uint32 | cEmbedded |
A large value that gets added to the refcount to mark the object as embedded. | |
Base class for shapes that decorate another shape with extra functionality (e.g. scale, translation etc.)
|
inlineexplicit |
Constructor.
|
inline |
DecoratedShape::DecoratedShape | ( | EShapeSubType | inSubType, |
const DecoratedShapeSettings & | inSettings, | ||
ShapeResult & | outResult ) |
All shapes are centered around their center of mass. This function returns the center of mass position that needs to be applied to transform the shape to where it was created.
Reimplemented from Shape.
Reimplemented in OffsetCenterOfMassShape, RotatedTranslatedShape, and ScaledShape.
|
overridevirtual |
Get the material assigned to a particular sub shape ID.
Implements Shape.
|
overridevirtual |
Volume of this shape (m^3). Note that for compound shapes the volume may be incorrect since child shapes can overlap which is not accounted for.
Get the combined stats of this shape and its children.
ioVisitedShapes | is used to track which shapes have already been visited, to avoid calculating the wrong memory size. |
Reimplemented from Shape.
Get the max number of sub shape ID bits that are needed to be able to address any leaf shape in this shape. Used mainly for checking that it is smaller or equal than SubShapeID::MaxBits.
Implements Shape.
|
overridevirtual |
Get the user data of a particular sub shape ID.
Reimplemented from Shape.
|
overridevirtual |
Get the vertices of the face that faces inDirection the most (includes any convex radius). Note that this function can only return faces of convex shapes or triangles, which is why a sub shape ID to get to that leaf must be provided.
inSubShapeID | Sub shape ID of target shape |
inDirection | Direction that the face should be facing (in local space to this shape) |
inCenterOfMassTransform | Transform to transform outVertices with |
inScale | Scale of this shape |
outVertices | Resulting face. The returned face can be empty if the shape doesn't have polygons to return (e.g. because it's a sphere). The face will be returned in world space. |
Reimplemented from Shape.
Reimplemented in OffsetCenterOfMassShape, RotatedTranslatedShape, and ScaledShape.
Check if this shape can only be used to create a static body or if it can also be dynamic/kinematic.
Reimplemented from Shape.
|
overridevirtual |
Restore the shape references after calling sRestoreFromBinaryState. Note that the exact same shapes need to be provided in the same order as returned by SaveSubShapeState.
Reimplemented from Shape.
Outputs the shape references that this shape has to outSubShapes.
Reimplemented from Shape.