Class CompositeShape
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Holds shape data to create 3D representations of objects. Also allows shapes to be overlayed on top of one another recursively.
[DocumentAsJson]
public class CompositeShape
- Inheritance
-
CompositeShape
- Inherited Members
- Extension Methods
Examples
"shape": { "base": "block/basic/cube" },
"shapeInventory": {
"base": "block/plant/bamboo/{color}/{part}-1",
"overlays": [ { "base": "block/plant/bamboo/{color}/{part}lod0-1" } ]
},
Fields
Alternates
The block shape may consists of any amount of alternatives, one of which will be randomly chosen when the shape is chosen.
[DocumentAsJson]
public CompositeShape[] Alternates
Field Value
BakedAlternates
Includes the base shape
public CompositeShape[] BakedAlternates
Field Value
Base
The path to this shape file.
[DocumentAsJson]
public AssetLocation Base
Field Value
Format
The format/filetype of this shape.
[DocumentAsJson]
public EnumShapeFormat Format
Field Value
IgnoreElements
If set will not tesselate elements with given name
public string[] IgnoreElements
Field Value
- string[]
InsertBakedTextures
Whether or not to insert baked in textures for mesh formats such as gltf into the texture atlas.
[DocumentAsJson]
public bool InsertBakedTextures
Field Value
Overlays
The shape will render all overlays on top of this shape. Can be used to group multiple shapes into one composite shape.
[DocumentAsJson]
public CompositeShape[] Overlays
Field Value
QuantityElements
If non zero will only tesselate the first n elements of the shape
[DocumentAsJson]
public int? QuantityElements
Field Value
- int?
Scale
The scale of this shape on all axes.
[DocumentAsJson]
public float Scale
Field Value
SelectiveElements
If set will only tesselate elements with given name
[DocumentAsJson]
public string[] SelectiveElements
Field Value
- string[]
VoxelizeTexture
If true, the shape is created from a voxelized version of the first defined texture
[DocumentAsJson]
public bool VoxelizeTexture
Field Value
offsetX
How much should this shape be offset on X axis?
[DocumentAsJson]
public float offsetX
Field Value
offsetY
How much should this shape be offset on Y axis?
[DocumentAsJson]
public float offsetY
Field Value
offsetZ
How much should this shape be offset on Z axis?
[DocumentAsJson]
public float offsetZ
Field Value
rotateX
How much, in degrees, should this shape be rotated around the X axis?
[DocumentAsJson]
public float rotateX
Field Value
rotateY
How much, in degrees, should this shape be rotated around the Y axis?
[DocumentAsJson]
public float rotateY
Field Value
rotateZ
How much, in degrees, should this shape be rotated around the Z axis?
[DocumentAsJson]
public float rotateZ
Field Value
Properties
OffsetXYZCopy
public Vec3f OffsetXYZCopy { get; }
Property Value
RotateXYZCopy
public Vec3f RotateXYZCopy { get; }
Property Value
Methods
Bake(IAssetManager, ILogger)
Alias to LoadAlternates
public void Bake(IAssetManager assetManager, ILogger logger)
Parameters
assetManager
IAssetManagerlogger
ILogger
Clone()
Creates a deep copy of the composite shape
public CompositeShape Clone()
Returns
CloneWithoutAlternates()
Creates a deep copy of the shape, but omitting its alternates (used to populate the alternates)
public CompositeShape CloneWithoutAlternates()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
LoadAlternates(IAssetManager, ILogger)
Expands the Composite Shape and populates the Baked field
public void LoadAlternates(IAssetManager assetManager, ILogger logger)
Parameters
assetManager
IAssetManagerlogger
ILogger
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.