diff --git a/org.sheepy.vsand.model.edit/plugin.properties b/org.sheepy.vsand.model.edit/plugin.properties index 033ca198..cfe8d42a 100644 --- a/org.sheepy.vsand.model.edit/plugin.properties +++ b/org.sheepy.vsand.model.edit/plugin.properties @@ -226,3 +226,4 @@ _UI_PrimaryColorPropertyCategory = Primary Color _UI_SecondaryColorPropertyCategory = Secondary Color _UI_VSandApplication_nextMode_feature = Next Mode _UI_VSandConstants_showSleepZones_feature = Show Sleep Zones +_UI_VSandConstants_forceClear_feature = Force Clear diff --git a/org.sheepy.vsand.model.edit/src/generated/java/org/sheepy/vsand/model/provider/VSandConstantsItemProvider.java b/org.sheepy.vsand.model.edit/src/generated/java/org/sheepy/vsand/model/provider/VSandConstantsItemProvider.java index b52e9e58..8cffa081 100644 --- a/org.sheepy.vsand.model.edit/src/generated/java/org/sheepy/vsand/model/provider/VSandConstantsItemProvider.java +++ b/org.sheepy.vsand.model.edit/src/generated/java/org/sheepy/vsand/model/provider/VSandConstantsItemProvider.java @@ -49,27 +49,27 @@ public List getPropertyDescriptors(Object object) { super.getPropertyDescriptors(object); - addFirstPassPropertyDescriptor(object); + addForceClearPropertyDescriptor(object); addShowSleepZonesPropertyDescriptor(object); } return itemPropertyDescriptors; } /** - * This adds a property descriptor for the First Pass feature. + * This adds a property descriptor for the Force Clear feature. * * * @generated */ - protected void addFirstPassPropertyDescriptor(Object object) + protected void addForceClearPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), - getString("_UI_VSandConstants_firstPass_feature"), - getString("_UI_PropertyDescriptor_description", "_UI_VSandConstants_firstPass_feature", "_UI_VSandConstants_type"), - VSandPackage.Literals.VSAND_CONSTANTS__FIRST_PASS, + getString("_UI_VSandConstants_forceClear_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_VSandConstants_forceClear_feature", "_UI_VSandConstants_type"), + VSandPackage.Literals.VSAND_CONSTANTS__FORCE_CLEAR, true, false, false, @@ -143,7 +143,7 @@ public void notifyChanged(Notification notification) switch (notification.getFeatureID(VSandConstants.class)) { - case VSandPackage.VSAND_CONSTANTS__FIRST_PASS: + case VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR: case VSandPackage.VSAND_CONSTANTS__SHOW_SLEEP_ZONES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; diff --git a/org.sheepy.vsand.model/model/VSand.xcore b/org.sheepy.vsand.model/model/VSand.xcore index dc7f16e6..2fead715 100644 --- a/org.sheepy.vsand.model/model/VSand.xcore +++ b/org.sheepy.vsand.model/model/VSand.xcore @@ -76,7 +76,7 @@ class RepeatComputePipeline extends ComputePipeline class VSandConstants extends AbstractConstants { - boolean firstPass = "true" + boolean forceClear = "false" boolean showSleepZones = "false" } diff --git a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandConstants.java b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandConstants.java index d2c7f3b3..4af9c12e 100644 --- a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandConstants.java +++ b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandConstants.java @@ -13,7 +13,7 @@ * The following features are supported: *

* * @@ -24,31 +24,27 @@ public interface VSandConstants extends AbstractConstants { /** - * Returns the value of the 'First Pass' attribute. - * The default value is "true". + * Returns the value of the 'Force Clear' attribute. + * The default value is "false". * - *

- * If the meaning of the 'First Pass' attribute isn't clear, - * there really should be more of a description here... - *

* - * @return the value of the 'First Pass' attribute. - * @see #setFirstPass(boolean) - * @see org.sheepy.vsand.model.VSandPackage#getVSandConstants_FirstPass() - * @model default="true" unique="false" + * @return the value of the 'Force Clear' attribute. + * @see #setForceClear(boolean) + * @see org.sheepy.vsand.model.VSandPackage#getVSandConstants_ForceClear() + * @model default="false" unique="false" * @generated */ - boolean isFirstPass(); + boolean isForceClear(); /** - * Sets the value of the '{@link org.sheepy.vsand.model.VSandConstants#isFirstPass First Pass}' attribute. + * Sets the value of the '{@link org.sheepy.vsand.model.VSandConstants#isForceClear Force Clear}' attribute. * * - * @param value the new value of the 'First Pass' attribute. - * @see #isFirstPass() + * @param value the new value of the 'Force Clear' attribute. + * @see #isForceClear() * @generated */ - void setFirstPass(boolean value); + void setForceClear(boolean value); /** * Returns the value of the 'Show Sleep Zones' attribute. diff --git a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandPackage.java b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandPackage.java index 3453a399..d20fd397 100644 --- a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandPackage.java +++ b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/VSandPackage.java @@ -790,13 +790,13 @@ public interface VSandPackage extends EPackage int VSAND_CONSTANTS__STAGES = ResourcePackage.ABSTRACT_CONSTANTS__STAGES; /** - * The feature id for the 'First Pass' attribute. + * The feature id for the 'Force Clear' attribute. * * * @generated * @ordered */ - int VSAND_CONSTANTS__FIRST_PASS = ResourcePackage.ABSTRACT_CONSTANTS_FEATURE_COUNT + 0; + int VSAND_CONSTANTS__FORCE_CLEAR = ResourcePackage.ABSTRACT_CONSTANTS_FEATURE_COUNT + 0; /** * The feature id for the 'Show Sleep Zones' attribute. @@ -1330,15 +1330,15 @@ public interface VSandPackage extends EPackage EClass getVSandConstants(); /** - * Returns the meta object for the attribute '{@link org.sheepy.vsand.model.VSandConstants#isFirstPass First Pass}'. + * Returns the meta object for the attribute '{@link org.sheepy.vsand.model.VSandConstants#isForceClear Force Clear}'. * * - * @return the meta object for the attribute 'First Pass'. - * @see org.sheepy.vsand.model.VSandConstants#isFirstPass() + * @return the meta object for the attribute 'Force Clear'. + * @see org.sheepy.vsand.model.VSandConstants#isForceClear() * @see #getVSandConstants() * @generated */ - EAttribute getVSandConstants_FirstPass(); + EAttribute getVSandConstants_ForceClear(); /** * Returns the meta object for the attribute '{@link org.sheepy.vsand.model.VSandConstants#isShowSleepZones Show Sleep Zones}'. @@ -1717,12 +1717,12 @@ interface Literals EClass VSAND_CONSTANTS = eINSTANCE.getVSandConstants(); /** - * The meta object literal for the 'First Pass' attribute feature. + * The meta object literal for the 'Force Clear' attribute feature. * * * @generated */ - EAttribute VSAND_CONSTANTS__FIRST_PASS = eINSTANCE.getVSandConstants_FirstPass(); + EAttribute VSAND_CONSTANTS__FORCE_CLEAR = eINSTANCE.getVSandConstants_ForceClear(); /** * The meta object literal for the 'Show Sleep Zones' attribute feature. diff --git a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandConstantsImpl.java b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandConstantsImpl.java index b9a44fa5..8dd7eaeb 100644 --- a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandConstantsImpl.java +++ b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandConstantsImpl.java @@ -19,7 +19,7 @@ * The following features are implemented: *

* * @@ -28,24 +28,24 @@ public class VSandConstantsImpl extends AbstractConstantsImpl implements VSandConstants { /** - * The default value of the '{@link #isFirstPass() First Pass}' attribute. + * The default value of the '{@link #isForceClear() Force Clear}' attribute. * * - * @see #isFirstPass() + * @see #isForceClear() * @generated * @ordered */ - protected static final boolean FIRST_PASS_EDEFAULT = true; + protected static final boolean FORCE_CLEAR_EDEFAULT = false; /** - * The cached value of the '{@link #isFirstPass() First Pass}' attribute. + * The cached value of the '{@link #isForceClear() Force Clear}' attribute. * * - * @see #isFirstPass() + * @see #isForceClear() * @generated * @ordered */ - protected boolean firstPass = FIRST_PASS_EDEFAULT; + protected boolean forceClear = FORCE_CLEAR_EDEFAULT; /** * The default value of the '{@link #isShowSleepZones() Show Sleep Zones}' attribute. @@ -94,9 +94,9 @@ protected EClass eStaticClass() * @generated */ @Override - public boolean isFirstPass() + public boolean isForceClear() { - return firstPass; + return forceClear; } /** @@ -105,12 +105,12 @@ public boolean isFirstPass() * @generated */ @Override - public void setFirstPass(boolean newFirstPass) + public void setForceClear(boolean newForceClear) { - boolean oldFirstPass = firstPass; - firstPass = newFirstPass; + boolean oldForceClear = forceClear; + forceClear = newForceClear; if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, VSandPackage.VSAND_CONSTANTS__FIRST_PASS, oldFirstPass, firstPass)); + eNotify(new ENotificationImpl(this, Notification.SET, VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR, oldForceClear, forceClear)); } /** @@ -148,8 +148,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { - case VSandPackage.VSAND_CONSTANTS__FIRST_PASS: - return isFirstPass(); + case VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR: + return isForceClear(); case VSandPackage.VSAND_CONSTANTS__SHOW_SLEEP_ZONES: return isShowSleepZones(); } @@ -166,8 +166,8 @@ public void eSet(int featureID, Object newValue) { switch (featureID) { - case VSandPackage.VSAND_CONSTANTS__FIRST_PASS: - setFirstPass((Boolean)newValue); + case VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR: + setForceClear((Boolean)newValue); return; case VSandPackage.VSAND_CONSTANTS__SHOW_SLEEP_ZONES: setShowSleepZones((Boolean)newValue); @@ -186,8 +186,8 @@ public void eUnset(int featureID) { switch (featureID) { - case VSandPackage.VSAND_CONSTANTS__FIRST_PASS: - setFirstPass(FIRST_PASS_EDEFAULT); + case VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR: + setForceClear(FORCE_CLEAR_EDEFAULT); return; case VSandPackage.VSAND_CONSTANTS__SHOW_SLEEP_ZONES: setShowSleepZones(SHOW_SLEEP_ZONES_EDEFAULT); @@ -206,8 +206,8 @@ public boolean eIsSet(int featureID) { switch (featureID) { - case VSandPackage.VSAND_CONSTANTS__FIRST_PASS: - return firstPass != FIRST_PASS_EDEFAULT; + case VSandPackage.VSAND_CONSTANTS__FORCE_CLEAR: + return forceClear != FORCE_CLEAR_EDEFAULT; case VSandPackage.VSAND_CONSTANTS__SHOW_SLEEP_ZONES: return showSleepZones != SHOW_SLEEP_ZONES_EDEFAULT; } @@ -225,8 +225,8 @@ public String toString() if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); - result.append(" (firstPass: "); - result.append(firstPass); + result.append(" (forceClear: "); + result.append(forceClear); result.append(", showSleepZones: "); result.append(showSleepZones); result.append(')'); diff --git a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandPackageImpl.java b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandPackageImpl.java index 3c1f3ed8..7d566e6c 100644 --- a/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandPackageImpl.java +++ b/org.sheepy.vsand/src/generated/java/org/sheepy/vsand/model/impl/VSandPackageImpl.java @@ -510,7 +510,7 @@ public EClass getVSandConstants() * @generated */ @Override - public EAttribute getVSandConstants_FirstPass() + public EAttribute getVSandConstants_ForceClear() { return (EAttribute)vSandConstantsEClass.getEStructuralFeatures().get(0); } @@ -681,7 +681,7 @@ public void createPackageContents() createEAttribute(repeatComputePipelineEClass, REPEAT_COMPUTE_PIPELINE__REPEAT_COUNT); vSandConstantsEClass = createEClass(VSAND_CONSTANTS); - createEAttribute(vSandConstantsEClass, VSAND_CONSTANTS__FIRST_PASS); + createEAttribute(vSandConstantsEClass, VSAND_CONSTANTS__FORCE_CLEAR); createEAttribute(vSandConstantsEClass, VSAND_CONSTANTS__SHOW_SLEEP_ZONES); materialSelectorPanelEClass = createEClass(MATERIAL_SELECTOR_PANEL); @@ -772,7 +772,7 @@ public void initializePackageContents() initEAttribute(getRepeatComputePipeline_RepeatCount(), theEcorePackage.getEInt(), "repeatCount", "1", 0, 1, RepeatComputePipeline.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(vSandConstantsEClass, VSandConstants.class, "VSandConstants", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getVSandConstants_FirstPass(), theEcorePackage.getEBoolean(), "firstPass", "true", 0, 1, VSandConstants.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVSandConstants_ForceClear(), theEcorePackage.getEBoolean(), "forceClear", "false", 0, 1, VSandConstants.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getVSandConstants_ShowSleepZones(), theEcorePackage.getEBoolean(), "showSleepZones", "false", 0, 1, VSandConstants.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(materialSelectorPanelEClass, MaterialSelectorPanel.class, "MaterialSelectorPanel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/ConfigurationBufferLoader.java b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/ConfigurationBufferLoader.java index 8c55e129..6c58e1d2 100644 --- a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/ConfigurationBufferLoader.java +++ b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/ConfigurationBufferLoader.java @@ -17,7 +17,7 @@ @Adapter(scope = Buffer.class, name = "Configuration") public class ConfigurationBufferLoader extends BufferAdapter { - private static final int BYTE_SIZE = MaterialUtil.MAX_MATERIAL_NUMBER * 4 * Integer.BYTES; + private static final int BYTE_SIZE = MaterialUtil.MAX_MATERIAL_NUMBER * 8 * Integer.BYTES; public ConfigurationBufferLoader(Buffer buffer) { @@ -33,9 +33,14 @@ public ConfigurationBufferLoader(Buffer buffer) bBuffer.putInt(material.getDensity()); bBuffer.putInt(material.getRunoff()); - final int rgb = material.getR() | material.getG() << 8 | material.getB() << 16; + // Alignment + bBuffer.putInt(0); - bBuffer.putInt(rgb); + // Color + bBuffer.putFloat(material.getR() / 255f); + bBuffer.putFloat(material.getG() / 255f); + bBuffer.putFloat(material.getB() / 255f); + bBuffer.putFloat(0f); } bBuffer.flip(); diff --git a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/VSandConstantAdapter.java b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/VSandConstantAdapter.java index 3ffc9c95..cc2e4631 100644 --- a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/VSandConstantAdapter.java +++ b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/adapter/VSandConstantAdapter.java @@ -29,11 +29,6 @@ public VSandConstantAdapter(VSandConstants constants) this.constants = constants; } - public void tick() - { - constants.setFirstPass(true); - } - @Override public void allocate(MemoryStack stack, IAllocationContext context) { @@ -55,17 +50,16 @@ protected int getSize() @Override public ByteBuffer getData() { - int firstPass = 0; - if (constants.isFirstPass()) + int forceClear = 0; + if (constants.isForceClear()) { - firstPass = 1; - constants.setFirstPass(false); + forceClear = 1; } final float rNumber = random.nextFloat(); buffer.putFloat(rNumber); - buffer.putInt(firstPass); + buffer.putInt(forceClear); buffer.putInt(constants.isShowSleepZones() ? 1 : 0); buffer.flip(); diff --git a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/input/VSandInputManager.java b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/input/VSandInputManager.java index 5c37bb26..9bf51bf2 100644 --- a/org.sheepy.vsand/src/main/java/org/sheepy/vsand/input/VSandInputManager.java +++ b/org.sheepy.vsand/src/main/java/org/sheepy/vsand/input/VSandInputManager.java @@ -100,10 +100,21 @@ else if (event.state == EKeyState.RELEASED) break; // s case 's' - 32: + constants.setForceClear(true); constants.setShowSleepZones(!constants.isShowSleepZones()); break; } } + else + { + switch (event.key) + { + // s + case 's' - 32: + constants.setForceClear(false); + break; + } + } } @Override @@ -112,8 +123,8 @@ public void onScrollEvent(ScrollEvent event) Material mainMaterial = null; if (shiftPressed) mainMaterial = application.getSecondaryMaterial(); else mainMaterial = application.getMainMaterial(); - var materials = application.getMaterials().getMaterials(); - int index = materials.indexOf(mainMaterial); + final var materials = application.getMaterials().getMaterials(); + final int index = materials.indexOf(mainMaterial); Material next = null; if (event.yOffset > 0f) diff --git a/org.sheepy.vsand/src/main/resources/Application.vsand b/org.sheepy.vsand/src/main/resources/Application.vsand index 6f0f302c..23056457 100644 --- a/org.sheepy.vsand/src/main/resources/Application.vsand +++ b/org.sheepy.vsand/src/main/resources/Application.vsand @@ -110,16 +110,10 @@ - - - - - - @@ -129,9 +123,6 @@ - - - @@ -139,9 +130,6 @@ - - - diff --git a/org.sheepy.vsand/src/main/resources/board_to_pixel.comp b/org.sheepy.vsand/src/main/resources/board_to_pixel.comp index 000954ec..3abb1634 100644 --- a/org.sheepy.vsand/src/main/resources/board_to_pixel.comp +++ b/org.sheepy.vsand/src/main/resources/board_to_pixel.comp @@ -21,13 +21,14 @@ struct Entry int isStatic; int density; int runoff; - uint rgb; + int padding; + vec4 color; }; // Random number, change each frame. layout (push_constant) uniform PushConstants { float random; - int firstPass; + int forceClear; int showSleepChunks; } pushConstants; @@ -36,7 +37,7 @@ layout(binding = 0) uniform SConfiguration Entry materials[MATERIAL_COUNT]; }configuration; -layout(binding = 1) readonly buffer SBoard +layout(binding = 1) buffer SBoard { int data[WIDTH][HEIGHT]; int chunks[CHUNK_WIDTH][CHUNK_HEIGHT]; @@ -53,13 +54,26 @@ void main() if (gl_GlobalInvocationID.y >= HEIGHT) return; - if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 4) == 0) + if(gl_LocalInvocationIndex == 0) + { + if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 4) != 0) + { + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] |= 8; + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] ^= 4; + } + else if ((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 8) != 0) + { + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] ^= 8; + } + } + + if(pushConstants.forceClear == 0 && (board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 12) == 0) { if(pushConstants.showSleepChunks == 1) { uint index = board.data[gl_GlobalInvocationID.x][gl_GlobalInvocationID.y]; Entry material = configuration.materials[index]; - vec4 color = unpackUnorm4x8(material.rgb) / 4; + vec4 color = material.color / 4; color.r = 0.0; imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), DEBUG_COLOR + color); } @@ -68,6 +82,5 @@ void main() uint index = board.data[gl_GlobalInvocationID.x][gl_GlobalInvocationID.y]; Entry material = configuration.materials[index]; - vec4 color = unpackUnorm4x8(material.rgb); - imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), color); + imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), material.color); } diff --git a/org.sheepy.vsand/src/main/resources/board_to_pixel.comp.spv b/org.sheepy.vsand/src/main/resources/board_to_pixel.comp.spv index 2e0824fb..49ee80ff 100644 --- a/org.sheepy.vsand/src/main/resources/board_to_pixel.comp.spv +++ b/org.sheepy.vsand/src/main/resources/board_to_pixel.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72de1d0bd497fd7f430721d9ff329a449241d24fe9773f00cc765f42f8da6ae9 -size 4228 +oid sha256:b19b9033b69abdfa96127460b6c9a3ee574a3135b13298053f3b2a65657e06fd +size 5608 diff --git a/org.sheepy.vsand/src/main/resources/draw.comp b/org.sheepy.vsand/src/main/resources/draw.comp index f4d7db94..4f36d9ef 100644 --- a/org.sheepy.vsand/src/main/resources/draw.comp +++ b/org.sheepy.vsand/src/main/resources/draw.comp @@ -84,7 +84,7 @@ void main() if (isInShape) { board.data[x][y] = attributes.value; - board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] = 7; + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] |= 3; } } } diff --git a/org.sheepy.vsand/src/main/resources/draw.comp.spv b/org.sheepy.vsand/src/main/resources/draw.comp.spv index 321962dc..e896dc10 100644 --- a/org.sheepy.vsand/src/main/resources/draw.comp.spv +++ b/org.sheepy.vsand/src/main/resources/draw.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:461fae257dda81f8abc23ac7f328341c8b9ca0ea39fe9f0ae1be1d0c5ac57386 -size 8340 +oid sha256:0a372ba8d723567cd87b1edf4fbbe5fe935d05ca395a1dd36423bd805b93b20f +size 8404 diff --git a/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp b/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp index 6475ba90..bb54705e 100644 --- a/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp +++ b/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp @@ -36,13 +36,14 @@ struct Entry int isStatic; int density; int runoff; - uint rgb; + int padding; + vec4 color; }; // Random number, change each frame. layout (push_constant) uniform PushConstants { float random; - int firstPass; + int forceClear; int showSleepChunks; } pushConstants; @@ -97,9 +98,8 @@ void main() decision.data[x][y] = (((decision.data[x][y] >> 8) << 24) >> 16) | (currentValue << INITIAL_VALUE_POSITION); - // If disabled chunk and not edge cell, we return - if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 7) == 0 + if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 2) == 0 && (gl_LocalInvocationID.x != 0 && gl_LocalInvocationID.x != 31) && (gl_LocalInvocationID.y != 0 && gl_LocalInvocationID.y != 31) && gl_GlobalInvocationID.y != HEIGHT - 1) diff --git a/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp.spv b/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp.spv index 5380dfa5..bbbf405d 100644 --- a/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp.spv +++ b/org.sheepy.vsand/src/main/resources/game_step1_chooseTO.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c154b37f562c14960e0fdccb9fd003a7bc02e9dec1ca35579d7773257463ef74 -size 11356 +oid sha256:c8f97ac30f3685dd808cfa64a627c1e4fb5a3515234adde4d4847f44618dfae4 +size 11404 diff --git a/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp b/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp index 241e4cfb..8ec23f95 100644 --- a/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp +++ b/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp @@ -37,13 +37,14 @@ struct Entry int isStatic; int density; int runoff; - uint rgb; + int padding; + vec4 color; }; // Random number, change each frame. layout (push_constant) uniform PushConstants { float random; - int firstPass; + int forceClear; int showSleepChunks; } pushConstants; @@ -84,6 +85,12 @@ void main() if (gl_GlobalInvocationID.y >= HEIGHT) return; + if(gl_LocalInvocationIndex == 0) + { + // Clean all except 1 + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] &= 5; + } + // If disabled chunk and not edge cell, we return if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 1) == 0 && (gl_LocalInvocationID.x != 0 && gl_LocalInvocationID.x != 31) @@ -172,7 +179,7 @@ void main() | maskDir | (targetValue << TARGET_VALUE_POSITION); - board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] |= 1; + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] = 1; i = 4; //break; } diff --git a/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp.spv b/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp.spv index efcc8be7..608a0551 100644 --- a/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp.spv +++ b/org.sheepy.vsand/src/main/resources/game_step2_acceptFROM.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24f3f621b8615be852c4dee1fa7fe65afd425e7827fd8514204a7ed37a9a0ad9 -size 6896 +oid sha256:fd98db4f4f9fc7166d266d48467a09f602b0ce7db301d20095321f85911a1496 +size 7244 diff --git a/org.sheepy.vsand/src/main/resources/game_step3_swap.comp b/org.sheepy.vsand/src/main/resources/game_step3_swap.comp index e6dcb79d..74cc2c69 100644 --- a/org.sheepy.vsand/src/main/resources/game_step3_swap.comp +++ b/org.sheepy.vsand/src/main/resources/game_step3_swap.comp @@ -39,13 +39,14 @@ struct Entry int isStatic; int density; int runoff; - uint rgb; + int padding; + vec4 color; }; // Random number, change each frame. layout (push_constant) uniform PushConstants { float random; - int firstPass; + int forceClear; int showSleepChunks; } pushConstants; @@ -180,7 +181,7 @@ void main() } board.data[x][y] = int(targetValue); - board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y + workgroupOffset] = 2; + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y + workgroupOffset] |= 1; } } } diff --git a/org.sheepy.vsand/src/main/resources/game_step3_swap.comp.spv b/org.sheepy.vsand/src/main/resources/game_step3_swap.comp.spv index 1dadab3a..09e3f36b 100644 --- a/org.sheepy.vsand/src/main/resources/game_step3_swap.comp.spv +++ b/org.sheepy.vsand/src/main/resources/game_step3_swap.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1cf0a09c13be92412106e740ecd3dfdd1a0e3a8a7128ea013249300ec0655aef -size 6688 +oid sha256:0b8099406470803df56fb01ceb5d4a7b5fb1958db595aae655dd577ede9d611d +size 6800 diff --git a/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp b/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp index faa334f1..15cc1feb 100644 --- a/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp +++ b/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp @@ -37,13 +37,14 @@ struct Entry int isStatic; int density; int runoff; - uint rgb; + int padding; + vec4 color; }; // Random number, change each frame. layout (push_constant) uniform PushConstants { float random; - int firstPass; + int forceClear; int showSleepChunks; } pushConstants; @@ -103,13 +104,9 @@ void main() if(gl_LocalInvocationIndex == 0) { - if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 3) != 0) + if((board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] & 1) != 0) { - board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] = 4; - } - else if (pushConstants.firstPass == 1) - { - board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] = 0; + board.chunks[gl_WorkGroupID.x][gl_WorkGroupID.y] = 6; } } diff --git a/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp.spv b/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp.spv index 087bb27d..3f4eb212 100644 --- a/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp.spv +++ b/org.sheepy.vsand/src/main/resources/game_step4_transformation.comp.spv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f7218c28b461a0688789b70b8f64550ffa28a533f074de0e7d953716812bc40 -size 9096 +oid sha256:231f64bfa9e43a38fa19170538f16b1ba3be78d35e80dab410b7c6a7e44e0368 +size 8876