mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 14:33:57 +01:00
The 3 time world heavyweight champion
- Fix instance hiding on indirect
This commit is contained in:
parent
c8d76c32a7
commit
eae1d0ef94
@ -156,6 +156,27 @@ public class IndirectInstancer<I extends Instance> extends AbstractInstancer<I>
|
||||
public InstanceHandleImpl.State<I> setDeleted(int index) {
|
||||
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
||||
|
||||
clear(localIndex);
|
||||
|
||||
return InstanceHandleImpl.Deleted.instance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstanceHandleImpl.State<I> setVisible(InstanceHandleImpl<I> handle, int index, boolean visible) {
|
||||
if (visible) {
|
||||
return this;
|
||||
}
|
||||
|
||||
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
||||
|
||||
var out = instances[localIndex];
|
||||
|
||||
clear(localIndex);
|
||||
|
||||
return new InstanceHandleImpl.Hidden<>(parent.recreate, out);
|
||||
}
|
||||
|
||||
private void clear(int localIndex) {
|
||||
instances[localIndex] = null;
|
||||
handles[localIndex] = null;
|
||||
|
||||
@ -174,22 +195,11 @@ public class IndirectInstancer<I extends Instance> extends AbstractInstancer<I>
|
||||
}
|
||||
// Set full page last so that other threads don't race to set the other bitsets.
|
||||
parent.fullPages.clear(pageNo);
|
||||
return InstanceHandleImpl.Deleted.instance();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InstanceHandleImpl.State<I> setVisible(InstanceHandleImpl<I> handle, int index, boolean visible) {
|
||||
if (visible) {
|
||||
return this;
|
||||
}
|
||||
|
||||
int localIndex = index % ObjectStorage.PAGE_SIZE;
|
||||
|
||||
return new InstanceHandleImpl.Hidden<>(parent.recreate, instances[localIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only call this on 2 pages that are mergeable.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user