Skip to content

Commit

Permalink
Remove RegisterRender overload with no Bounds parameter
Browse files Browse the repository at this point in the history
This commit brings breaking changes. To upgrade to this version you need now use overload with explicit bounds parameter.
  • Loading branch information
Antoshidza committed Jan 11, 2024
1 parent dd745fc commit abf1821
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ renderArchetypeStorage.RegisterRender
(
renderID,
material, // material with [Enable GPU Instancing] enabled and shader supporting instancing
bounds // bounds in which sprites will be visible. For example new Bounds(Vector3.zero, Vector3.one * float.MaxValue)
null, // override for MaterialPropertyBlock if needed
128, // initial ComputeBuffers capacity
128, // minimal capacity step for ComputeBuffers
Expand Down
17 changes: 0 additions & 17 deletions Rendering/Components/RenderArchetypeStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class RenderArchetypeStorage : IComponentData
internal readonly HashSet<int> RegisteredIds = new();
/// <summary> System's state with all necessary data to pass to <see cref="RenderArchetype"/> to update </summary>
internal SystemData SystemData;

internal static Bounds DefaultBounds => new (Vector3.zero, Vector3.one * 1000f);

internal void Dispose()
{
Expand Down Expand Up @@ -67,21 +65,6 @@ private void GatherPropertiesTypes()
foreach (var property in InstancedPropertyComponent.GetProperties())
BindComponentToShaderProperty(property.propertyName, property.componentType);
}

/// <summary>
/// Register render, which is combination of Material + set of StructuredBuffer property names in shader.
/// Every entity with <see cref="SpriteRenderID"/> component with ID value equal to passed ID, will be rendered by registered render.
/// Entity without instanced property component from passed properties will be rendered with uninitialized values (please, initialize entities carefully, because render with uninitialized values can lead to strange visual results).
/// Though you can use <b><see cref="NSPRITES_PROPERTY_FALLBACK_ENABLE"/></b> directive to enable fallback values, so any chunk without property component will pass default values.
/// <param name="id">ID of <see cref="SpriteRenderID"/>.<see cref="SpriteRenderID.id"/>. All entities with the same SCD will be updated by registering render archetype. Client should manage uniqueness (or not) of ids by himself.</param>
/// <param name="material"><see cref="Material"/> which will be used to render sprites.</param>
/// <param name="materialPropertyBlock"><see cref="MaterialPropertyBlock"/> you can pass if you want to do some extra overriding by yourself.</param>
/// <param name="propertyDataSet">IDs of StructuredBuffer properties in shader AND <see cref="PropertyUpdateMode"/> for each property.</param>
/// <param name="initialCapacity">compute buffers initial capacity.</param>
/// <param name="capacityStep">compute buffers capacity increase step when the current limit on the number of entities is exceeded.</param>
/// </summary>
public void RegisterRender(in int id, Material material, MaterialPropertyBlock materialPropertyBlock = null, in int initialCapacity = 1, in int capacityStep = 1, params PropertyData[] propertyDataSet)
=> RegisterRender(id, material, Quad, DefaultBounds, materialPropertyBlock, initialCapacity, capacityStep, propertyDataSet);

/// <summary>
/// Register render, which is combination of Material + set of StructuredBuffer property names in shader.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.tonymax.nsprites",
"version": "3.2.0",
"version": "4.0.0",
"displayName": "NSprites",
"description": "Entities sprite rendering system. Uses GPU instancing with compute buffers to draw entities as sprites.",
"unity": "2022.2",
Expand Down

0 comments on commit abf1821

Please sign in to comment.