Class StaticTrailData
For each trail object, a fixed amount of vRAM is pre‑allocated for storing its rendering data,
this amount depends on the trail duration(fadeIn + full + fadeOut) and the trail quality configuration.
Therefore, the duration should not be set too long, as doing so may consume excessive vRAM.
For (M)VP matrix, always is BoxEnum.ENTITY_VANILLA_PRIME_MATRIX.
To reduce overhead and permit special values for custom effects, the trail system does not heavily validate parameters, so you must ensure the correctness of the values they supply.
TECHNICAL DETAILS
When a trail is created, the trail system assumes that after it starts generating,
it will continue generating for at least the given duration before stopping (or still running);
accordingly, a sufficiently large fixed‑size vRAM block is allocated.
Each recorded node in the trail occupies 24 bytes of vRAM.
In addition to the minimum number of nodes required to form a trail,
an extra fixed 3 fill-nodes are allocated for proper rendering.
Based on the configured maximum number of nodes recordable per second(nodePerSeconds),
and provided that all components of the duration are non‑negative, the allocated vRAM for one trail is:
24 * (ceil(duration * nodePerSeconds) + 3) bytes
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanorg.lwjgl.util.vector.Vector2forg.lwjgl.util.vector.Vector2forg.lwjgl.util.vector.Vector4forg.lwjgl.util.vector.Vector4ffloatfloatfloatorg.lwjgl.util.vector.Vector4ffinal StringThe unique ID in game.final shortHow many trails have in a typical scene.static final floatbooleanbooleanfloatfloatfloatfloatfloatbooleanorg.lwjgl.util.vector.Vector4forg.lwjgl.util.vector.Vector4f -
Constructor Summary
ConstructorsConstructorDescriptionStaticTrailData(String id, short initCapacity) StaticTrailData(StaticTrailData src, String id, short initCapacity) Deep copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal inthashCode()setAdditiveBlend(boolean additiveBlend) Use additive blend whentrue,falsefor normal blend.setAngularInRange(org.lwjgl.util.vector.Vector2f angularInRange) Based on forward direction.setAngularOutRange(org.lwjgl.util.vector.Vector2f angularOutRange) Based on forward direction.setColorIn(org.lwjgl.util.vector.Vector4f colorIn) nullfor white color with full opacity.setColorOut(org.lwjgl.util.vector.Vector4f colorOut) nullfor white color with full opacity.setCustomTrackerID(String trackerID) Only for system-gen trail, invalid for custom trail, not required.setDurFadeIn(float durFadeIn) MUST be the const field, and greater than or equal to zero.setDurFadeOut(float durFadeOut) MUST be the const field, and greater than or equal to zero.setDurFull(float durFull) MUST be the const field, and greater than or equal to zero.setFixedSpawnOffsetRange(org.lwjgl.util.vector.Vector4f fixedSpawnOffsetRange) Only for system-gen trail, invalid for custom trail, not required.setMaterial(MaterialData material) For cull face state, always usedBoxEnum.MATERIAL_CULL_DISABLED.setRandomUVStartOffset(boolean randomUVStartOffset) Whether to apply a random offset to the UV coordinates for texture sampling, may make the trail more naturally.setRenderBelowExplosions(boolean renderBelowExplosions) Only for system-gen trail, invalid for custom trail, not required.setSizeIn(float sizeIn) The head width of trail in pixels.setSizeOut(float sizeOut) The tail width of trail in pixels.setSmoothEnds(float duration) Controls the transparency fade at both ends of a trail to smooth truncation.setTexturePixels(float texturePixels) MUST be the const field, and should be a positive number.setTextureSpeed(float textureSpeed) The texture scrolling length in one seconds.setVelocityForForward(boolean velocityForForward) Only for system-gen trail, invalid for custom trail, not required.setVelocityInRange(org.lwjgl.util.vector.Vector4f velocityInRange) Based on forward direction.setVelocityOutRange(org.lwjgl.util.vector.Vector4f velocityOutRange) Based on forward direction.toString()
-
Field Details
-
MINIMUM_TOTAL_DURATION
public static final float MINIMUM_TOTAL_DURATION- See Also:
-
randomUVStartOffset
public boolean randomUVStartOffset -
additiveBlend
public boolean additiveBlend -
velocityForForward
public boolean velocityForForward -
renderBelowExplosions
public boolean renderBelowExplosions -
initCapacity
public final short initCapacityHow many trails have in a typical scene. -
durFadeIn
public float durFadeIn -
durFull
public float durFull -
durFadeOut
public float durFadeOut -
sizeIn
public float sizeIn -
sizeOut
public float sizeOut -
smoothEnds
public float smoothEnds -
texturePixels
public float texturePixels -
textureSpeed
public float textureSpeed -
id
The unique ID in game. -
material
-
angularInRange
@Nullable public org.lwjgl.util.vector.Vector2f angularInRange -
angularOutRange
@Nullable public org.lwjgl.util.vector.Vector2f angularOutRange -
colorIn
@Nullable public org.lwjgl.util.vector.Vector4f colorIn -
colorOut
@Nullable public org.lwjgl.util.vector.Vector4f colorOut -
velocityInRange
@Nullable public org.lwjgl.util.vector.Vector4f velocityInRange -
velocityOutRange
@Nullable public org.lwjgl.util.vector.Vector4f velocityOutRange -
fixedSpawnOffsetRange
@Nullable public org.lwjgl.util.vector.Vector4f fixedSpawnOffsetRange -
customTrackerID
-
-
Constructor Details
-
StaticTrailData
- Parameters:
id- IMPORTANT, the unique ID in game, to define the unique trail style type and memory pool, for exampleABCD_efgh_trail.MUST be the const field.
CANNOT be empty or contains only white space codepoints.
initCapacity- how many trails have in a typical scene, for example: 2048 for the weapon [vulkan]
-
StaticTrailData
Deep copy constructor.- Parameters:
id- IMPORTANT, the unique ID in game, to define the unique trail style type and memory pool, for exampleABCD_abcd_trail.MUST be the const field.
CANNOT be empty or contains only white space codepoints.
initCapacity- how many trails have in a typical scene, for example: 2048 for the weapon [vulkan]
-
-
Method Details
-
setRandomUVStartOffset
Whether to apply a random offset to the UV coordinates for texture sampling, may make the trail more naturally. -
setAdditiveBlend
Use additive blend whentrue,falsefor normal blend. -
setVelocityForForward
Only for system-gen trail, invalid for custom trail, not required.Use the facing of entity for forward direction when
false, use the velocity of entity whentrue.For any stationary projectiles (velocity is a zero vector), also use facing for forward.
Recommended to set to
trueif the spawnType of projectile isBALLISTIC_AS_BEAM. -
setRenderBelowExplosions
Only for system-gen trail, invalid for custom trail, not required.Rendering at
CombatEngineLayers.BELOW_INDICATORS_LAYERwhenfalse, atCombatEngineLayers.ABOVE_SHIPS_LAYERwhentrue -
setDurFadeIn
MUST be the const field, and greater than or equal to zero. -
setDurFull
MUST be the const field, and greater than or equal to zero. -
setDurFadeOut
MUST be the const field, and greater than or equal to zero. -
setSizeIn
The head width of trail in pixels. -
setSizeOut
The tail width of trail in pixels. -
setSmoothEnds
Controls the transparency fade at both ends of a trail to smooth truncation. The fade only affects the first two and last two nodes; larger values stretch the faded area. The effective range also depends on the variable node‑per‑second recording rate. -
setTexturePixels
MUST be the const field, and should be a positive number. -
setTextureSpeed
The texture scrolling length in one seconds.Use negative value will look like away from the spawn location.
-
setMaterial
For cull face state, always usedBoxEnum.MATERIAL_CULL_DISABLED. -
setAngularInRange
Based on forward direction.{minAngular, maxAngular},nullfor without angular applied -
setAngularOutRange
Based on forward direction.{minAngular, maxAngular},nullfor without angular applied -
setColorIn
nullfor white color with full opacity. -
setColorOut
nullfor white color with full opacity. -
setVelocityInRange
Based on forward direction.{minVelocity.xy, maxVelocity.xy},nullfor without velocity applied -
setVelocityOutRange
public StaticTrailData setVelocityOutRange(@Nullable org.lwjgl.util.vector.Vector4f velocityOutRange) Based on forward direction.{minVelocity.xy, maxVelocity.xy},nullfor without velocity applied -
setFixedSpawnOffsetRange
public StaticTrailData setFixedSpawnOffsetRange(@Nullable org.lwjgl.util.vector.Vector4f fixedSpawnOffsetRange) Only for system-gen trail, invalid for custom trail, not required.Based on forward direction.
{minOffset.xy, maxOffset.xy},nullfor without offset -
setCustomTrackerID
Only for system-gen trail, invalid for custom trail, not required.The trail will try to use specific tracker by ID, call
StaticTrailManager.registerCustomTracker(String, BiFunction)for register one.nullor white space, or not find the tracker constructor with the ID, then the trail will use default built-in tracker. -
hashCode
public final int hashCode() -
equals
-
toString
-