Skip to content

Commit

Permalink
Fix sleep chunk, better debug view, minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Ealrann committed May 2, 2019
1 parent 7f2096b commit 813cf47
Show file tree
Hide file tree
Showing 23 changed files with 136 additions and 123 deletions.
1 change: 1 addition & 0 deletions org.sheepy.vsand.model.edit/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ public List<IItemPropertyDescriptor> 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.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion org.sheepy.vsand.model/model/VSand.xcore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RepeatComputePipeline extends ComputePipeline

class VSandConstants extends AbstractConstants
{
boolean firstPass = "true"
boolean forceClear = "false"
boolean showSleepZones = "false"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.sheepy.vsand.model.VSandConstants#isFirstPass <em>First Pass</em>}</li>
* <li>{@link org.sheepy.vsand.model.VSandConstants#isForceClear <em>Force Clear</em>}</li>
* <li>{@link org.sheepy.vsand.model.VSandConstants#isShowSleepZones <em>Show Sleep Zones</em>}</li>
* </ul>
*
Expand All @@ -24,31 +24,27 @@
public interface VSandConstants extends AbstractConstants
{
/**
* Returns the value of the '<em><b>First Pass</b></em>' attribute.
* The default value is <code>"true"</code>.
* Returns the value of the '<em><b>Force Clear</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>First Pass</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>First Pass</em>' attribute.
* @see #setFirstPass(boolean)
* @see org.sheepy.vsand.model.VSandPackage#getVSandConstants_FirstPass()
* @model default="true" unique="false"
* @return the value of the '<em>Force Clear</em>' 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 <em>First Pass</em>}' attribute.
* Sets the value of the '{@link org.sheepy.vsand.model.VSandConstants#isForceClear <em>Force Clear</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>First Pass</em>' attribute.
* @see #isFirstPass()
* @param value the new value of the '<em>Force Clear</em>' attribute.
* @see #isForceClear()
* @generated
*/
void setFirstPass(boolean value);
void setForceClear(boolean value);

/**
* Returns the value of the '<em><b>Show Sleep Zones</b></em>' attribute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,13 @@ public interface VSandPackage extends EPackage
int VSAND_CONSTANTS__STAGES = ResourcePackage.ABSTRACT_CONSTANTS__STAGES;

/**
* The feature id for the '<em><b>First Pass</b></em>' attribute.
* The feature id for the '<em><b>Force Clear</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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 '<em><b>Show Sleep Zones</b></em>' attribute.
Expand Down Expand Up @@ -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 <em>First Pass</em>}'.
* Returns the meta object for the attribute '{@link org.sheepy.vsand.model.VSandConstants#isForceClear <em>Force Clear</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>First Pass</em>'.
* @see org.sheepy.vsand.model.VSandConstants#isFirstPass()
* @return the meta object for the attribute '<em>Force Clear</em>'.
* @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 <em>Show Sleep Zones</em>}'.
Expand Down Expand Up @@ -1717,12 +1717,12 @@ interface Literals
EClass VSAND_CONSTANTS = eINSTANCE.getVSandConstants();

/**
* The meta object literal for the '<em><b>First Pass</b></em>' attribute feature.
* The meta object literal for the '<em><b>Force Clear</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute VSAND_CONSTANTS__FIRST_PASS = eINSTANCE.getVSandConstants_FirstPass();
EAttribute VSAND_CONSTANTS__FORCE_CLEAR = eINSTANCE.getVSandConstants_ForceClear();

/**
* The meta object literal for the '<em><b>Show Sleep Zones</b></em>' attribute feature.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.sheepy.vsand.model.impl.VSandConstantsImpl#isFirstPass <em>First Pass</em>}</li>
* <li>{@link org.sheepy.vsand.model.impl.VSandConstantsImpl#isForceClear <em>Force Clear</em>}</li>
* <li>{@link org.sheepy.vsand.model.impl.VSandConstantsImpl#isShowSleepZones <em>Show Sleep Zones</em>}</li>
* </ul>
*
Expand All @@ -28,24 +28,24 @@
public class VSandConstantsImpl extends AbstractConstantsImpl implements VSandConstants
{
/**
* The default value of the '{@link #isFirstPass() <em>First Pass</em>}' attribute.
* The default value of the '{@link #isForceClear() <em>Force Clear</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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() <em>First Pass</em>}' attribute.
* The cached value of the '{@link #isForceClear() <em>Force Clear</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @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() <em>Show Sleep Zones</em>}' attribute.
Expand Down Expand Up @@ -94,9 +94,9 @@ protected EClass eStaticClass()
* @generated
*/
@Override
public boolean isFirstPass()
public boolean isForceClear()
{
return firstPass;
return forceClear;
}

/**
Expand All @@ -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));
}

/**
Expand Down Expand Up @@ -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();
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}
Expand All @@ -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(')');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public EClass getVSandConstants()
* @generated
*/
@Override
public EAttribute getVSandConstants_FirstPass()
public EAttribute getVSandConstants_ForceClear()
{
return (EAttribute)vSandConstantsEClass.getEStructuralFeatures().get(0);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();

Expand Down
Loading

0 comments on commit 813cf47

Please sign in to comment.