mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 20:09:39 +00:00
Handle state changes for display lists correctly in GLSM (#168)
* Handle state changes in display lists correctly in GLSM * Add some documentation so it's slightly more clear as to what's happening --------- Co-authored-by: Jason Mitchell <[email protected]>
This commit is contained in:
1 parent
fbc1b1b440
commit
85e44369bb
1 file changed
+6
-1
@@ -55,6 +55,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -732,6 +733,7 @@ public class GLStateManager {
|
||||
glListMode = mode;
|
||||
GL11.glNewList(list, mode);
|
||||
for(IStateStack<?> stack : Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS)) {
|
||||
// Feature Stack, copy of current feature state
|
||||
glListStates.put(stack, (ISettableState<?>) ((ISettableState<?>)stack).copy());
|
||||
}
|
||||
if(glListMode == GL11.GL_COMPILE) {
|
||||
@@ -746,8 +748,10 @@ public class GLStateManager {
|
||||
|
||||
final Set<Map.Entry<IStateStack<?>, ISettableState<?>>> changedStates = new ObjectArraySet<>();
|
||||
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : glListStates.entrySet()) {
|
||||
// If the current stack state is different than the copy of the state at the start
|
||||
if(!((ISettableState<?>)entry.getKey()).sameAs(entry.getValue())) {
|
||||
changedStates.add(entry);
|
||||
// Then we want to put into the change set the stack and the copy of the state now
|
||||
changedStates.add(new AbstractMap.SimpleEntry<>(entry.getKey(), (ISettableState<?>) ((ISettableState<?>) entry.getKey()).copy()));
|
||||
}
|
||||
}
|
||||
if(changedStates.size() != 0) {
|
||||
@@ -769,6 +773,7 @@ public class GLStateManager {
|
||||
GL11.glCallList(list);
|
||||
if(glListChanges.containsKey(list)) {
|
||||
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : glListChanges.get(list)) {
|
||||
// Set the stack to the cached state at the end of the call list compilation
|
||||
((ISettableState<?>)entry.getKey()).set(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user