Commit 4ee28157 authored by amandaghassaei's avatar amandaghassaei
Browse files

actuators in chader

parent 42b70174
...@@ -602,77 +602,77 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G ...@@ -602,77 +602,77 @@ define(['underscore', 'backbone', 'threeModel', 'lattice', 'plist', 'emWire', 'G
iter: function(time, runConstants, shouldRender){ iter: function(time, runConstants, shouldRender){
//gpuMath.step("accelerationCalc", ["u_lastVelocity", "u_lastTranslation", "u_mass", "u_neighborsXMapping", gpuMath.step("accelerationCalc", ["u_lastVelocity", "u_lastTranslation", "u_mass", "u_neighborsXMapping",
// "u_neighborsYMapping", "u_compositeKs", "u_compositeDs", "u_originalPosition", "u_lastQuaternion", "u_wires", "u_neighborsYMapping", "u_compositeKs", "u_compositeDs", "u_originalPosition", "u_lastQuaternion", "u_wires",
// "u_wiresMeta"], "u_acceleration", time); "u_wiresMeta"], "u_acceleration", time);
//gpuMath.step("positionCalc", ["u_acceleration", "u_lastTranslation", "u_lastLastTranslation", "u_mass"], gpuMath.step("positionCalc", ["u_acceleration", "u_lastTranslation", "u_lastLastTranslation", "u_mass"],
// "u_translation"); "u_translation");
//gpuMath.step("velocityCalc", ["u_translation", "u_lastTranslation"], "u_velocity"); gpuMath.step("velocityCalc", ["u_translation", "u_lastTranslation"], "u_velocity");
//
//gpuMath.step("angVelocityCalc", ["u_lastAngVelocity", "u_lastVelocity", "u_lastTranslation", "u_mass", "u_neighborsXMapping", gpuMath.step("angVelocityCalc", ["u_lastAngVelocity", "u_lastVelocity", "u_lastTranslation", "u_mass", "u_neighborsXMapping",
// "u_neighborsYMapping", "u_compositeKs", "u_compositeDs", "u_lastQuaternion", "u_wires", "u_neighborsYMapping", "u_compositeKs", "u_compositeDs", "u_lastQuaternion", "u_wires",
// "u_wiresMeta"], "u_angVelocity", time); "u_wiresMeta"], "u_angVelocity", time);
//gpuMath.step("quaternionCalc", ["u_angVelocity", "u_lastQuaternion", "u_mass"], "u_quaternion"); gpuMath.step("quaternionCalc", ["u_angVelocity", "u_lastQuaternion", "u_mass"], "u_quaternion");
//
//if (shouldRender) { if (shouldRender) {
// var textureSize = this.textureSize[0]*this.textureSize[1]; var textureSize = this.textureSize[0]*this.textureSize[1];
//
// //get position //get position
// var vectorLength = 3; var vectorLength = 3;
// gpuMath.setProgram("packToBytes"); gpuMath.setProgram("packToBytes");
// gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f"); gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f");
// gpuMath.setSize(this.textureSize[0]*vectorLength, this.textureSize[1]); gpuMath.setSize(this.textureSize[0]*vectorLength, this.textureSize[1]);
// gpuMath.step("packToBytes", ["u_translation"], "outputPositionBytes"); gpuMath.step("packToBytes", ["u_translation"], "outputPositionBytes");
// var pixels = new Uint8Array(textureSize * 4*vectorLength); var pixels = new Uint8Array(textureSize * 4*vectorLength);
// if (gpuMath.readyToRead()) { if (gpuMath.readyToRead()) {
// gpuMath.readPixels(0, 0, this.textureSize[0] * vectorLength, this.textureSize[1], pixels); gpuMath.readPixels(0, 0, this.textureSize[0] * vectorLength, this.textureSize[1], pixels);
// var parsedPixels = new Float32Array(pixels.buffer); var parsedPixels = new Float32Array(pixels.buffer);
// var cells = lattice.getCells(); var cells = lattice.getCells();
// var multiplier = 1 / (plist.allUnitTypes[lattice.getUnits()].multiplier); var multiplier = 1 / (plist.allUnitTypes[lattice.getUnits()].multiplier);
// for (var i = 0; i < textureSize; i++) { for (var i = 0; i < textureSize; i++) {
// var rgbaIndex = 4 * i; var rgbaIndex = 4 * i;
// if (this.mass[rgbaIndex+1] < 0) continue;//no more cells if (this.mass[rgbaIndex+1] < 0) continue;//no more cells
// var index = [this.cellsArrayMapping[rgbaIndex], this.cellsArrayMapping[rgbaIndex + 1], this.cellsArrayMapping[rgbaIndex + 2]]; var index = [this.cellsArrayMapping[rgbaIndex], this.cellsArrayMapping[rgbaIndex + 1], this.cellsArrayMapping[rgbaIndex + 2]];
// var parsePixelsIndex = vectorLength * i; var parsePixelsIndex = vectorLength * i;
// var translation = [parsedPixels[parsePixelsIndex], parsedPixels[parsePixelsIndex + 1], parsedPixels[parsePixelsIndex + 2]]; var translation = [parsedPixels[parsePixelsIndex], parsedPixels[parsePixelsIndex + 1], parsedPixels[parsePixelsIndex + 2]];
// var position = [this.originalPosition[rgbaIndex], this.originalPosition[rgbaIndex + 1], this.originalPosition[rgbaIndex + 2]]; var position = [this.originalPosition[rgbaIndex], this.originalPosition[rgbaIndex + 1], this.originalPosition[rgbaIndex + 2]];
// position[0] += multiplier * translation[0]; position[0] += multiplier * translation[0];
// position[1] += multiplier * translation[1]; position[1] += multiplier * translation[1];
// position[2] += multiplier * translation[2]; position[2] += multiplier * translation[2];
// cells[index[0]][index[1]][index[2]].object3D.position.set(position[0], position[1], position[2]); cells[index[0]][index[1]][index[2]].object3D.position.set(position[0], position[1], position[2]);
// } }
// } }
//
// vectorLength = 4; vectorLength = 4;
// gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f"); gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f");
// gpuMath.setSize(this.textureSize[0]*vectorLength, this.textureSize[1]); gpuMath.setSize(this.textureSize[0]*vectorLength, this.textureSize[1]);
// gpuMath.step("packToBytes", ["u_quaternion"], "outputQuaternionBytes"); gpuMath.step("packToBytes", ["u_quaternion"], "outputQuaternionBytes");
// pixels = new Uint8Array(textureSize * 4*vectorLength); pixels = new Uint8Array(textureSize * 4*vectorLength);
// if (gpuMath.readyToRead()) { if (gpuMath.readyToRead()) {
// gpuMath.readPixels(0, 0, this.textureSize[0] * vectorLength, this.textureSize[1], pixels); gpuMath.readPixels(0, 0, this.textureSize[0] * vectorLength, this.textureSize[1], pixels);
// parsedPixels = new Float32Array(pixels.buffer); parsedPixels = new Float32Array(pixels.buffer);
// for (var i = 0; i < textureSize; i++) { for (var i = 0; i < textureSize; i++) {
// var rgbaIndex = 4 * i; var rgbaIndex = 4 * i;
// if (this.mass[rgbaIndex+1] < 0) break;//no more cells if (this.mass[rgbaIndex+1] < 0) break;//no more cells
// var index = [this.cellsArrayMapping[rgbaIndex], this.cellsArrayMapping[rgbaIndex + 1], this.cellsArrayMapping[rgbaIndex + 2]]; var index = [this.cellsArrayMapping[rgbaIndex], this.cellsArrayMapping[rgbaIndex + 1], this.cellsArrayMapping[rgbaIndex + 2]];
// var parsePixelsIndex = vectorLength * i; var parsePixelsIndex = vectorLength * i;
//
// var quaternion = this._multiplyQuaternions([parsedPixels[parsePixelsIndex], parsedPixels[parsePixelsIndex + 1], parsedPixels[parsePixelsIndex + 2], parsedPixels[parsePixelsIndex + 3]], var quaternion = this._multiplyQuaternions([parsedPixels[parsePixelsIndex], parsedPixels[parsePixelsIndex + 1], parsedPixels[parsePixelsIndex + 2], parsedPixels[parsePixelsIndex + 3]],
// [this.originalQuaternion[rgbaIndex], this.originalQuaternion[rgbaIndex+1], this.originalQuaternion[rgbaIndex+2], this.originalQuaternion[rgbaIndex+3]]); [this.originalQuaternion[rgbaIndex], this.originalQuaternion[rgbaIndex+1], this.originalQuaternion[rgbaIndex+2], this.originalQuaternion[rgbaIndex+3]]);
// var rotation = this._eulerFromQuaternion(quaternion); var rotation = this._eulerFromQuaternion(quaternion);
//
// cells[index[0]][index[1]][index[2]].object3D.rotation.set(rotation[0], rotation[1], rotation[2]); cells[index[0]][index[1]][index[2]].object3D.rotation.set(rotation[0], rotation[1], rotation[2]);
// } }
// } }
//
// gpuMath.setSize(this.textureSize[0], this.textureSize[1]); gpuMath.setSize(this.textureSize[0], this.textureSize[1]);
//} }
//
//gpuMath.swapTextures("u_velocity", "u_lastVelocity"); gpuMath.swapTextures("u_velocity", "u_lastVelocity");
//gpuMath.swap3Textures("u_translation", "u_lastTranslation", "u_lastLastTranslation"); gpuMath.swap3Textures("u_translation", "u_lastTranslation", "u_lastLastTranslation");
//gpuMath.swapTextures("u_angVelocity", "u_lastAngVelocity"); gpuMath.swapTextures("u_angVelocity", "u_lastAngVelocity");
//gpuMath.swapTextures("u_quaternion", "u_lastQuaternion"); gpuMath.swapTextures("u_quaternion", "u_lastQuaternion");
//return; return;
var gravity = runConstants.gravity; var gravity = runConstants.gravity;
var groundHeight = runConstants.groundHeight; var groundHeight = runConstants.groundHeight;
......
...@@ -70,6 +70,7 @@ int convertToInt(float num){ ...@@ -70,6 +70,7 @@ int convertToInt(float num){
} }
float getActuatorVoltage(float wireIndex){ float getActuatorVoltage(float wireIndex){
vec2 wireCoord = vec2(0.5, (floor(wireIndex+0.001)+0.5)/u_wiresMetaLength); vec2 wireCoord = vec2(0.5, (floor(wireIndex+0.001)+0.5)/u_wiresMetaLength);
vec4 wireMeta = texture2D(u_wiresMeta, wireCoord); vec4 wireMeta = texture2D(u_wiresMeta, wireCoord);
int type = convertToInt(wireMeta[0]); int type = convertToInt(wireMeta[0]);
...@@ -77,25 +78,34 @@ float getActuatorVoltage(float wireIndex){ ...@@ -77,25 +78,34 @@ float getActuatorVoltage(float wireIndex){
//no signal connected //no signal connected
return 0.0; return 0.0;
} }
int polarity = type/4;
type = convertToInt(mod(float(type), 4.0));
float frequency = wireMeta[1]; float frequency = wireMeta[1];
float period = 1.0/frequency; float period = 1.0/frequency;
float phase = wireMeta[2]; float phase = wireMeta[2];
float currentPhase = mod(u_time+phase*period, period)/period; float currentPhase = mod(u_time+phase*period, period)/period;
float invert = 1.0;
if (wireMeta[3] > 0.5) invert = -1.0;
if (polarity > 0) invert = -invert;
if (type == 0){ if (type == 0){
return 0.5*sin(2.0*M_PI*currentPhase); return invert*0.5*sin(2.0*M_PI*currentPhase);
} }
if (type == 1){ if (type == 1){
float pwm = wireMeta[3]; float pwm = wireMeta[3];
if (currentPhase < pwm) return 0.5; if (currentPhase < pwm) return invert*0.5;
return -0.5; return -0.5*invert;
} }
if (type == 2){ if (type == 2){
if (wireMeta[3]>0.5) return 0.5-currentPhase; if (wireMeta[3]>0.5) return invert*(0.5-currentPhase);
return currentPhase-0.5; return invert*(currentPhase-0.5);
} }
if (type == 3){ if (type == 3){
if (currentPhase < 0.5) return currentPhase*2.0-0.5; if (currentPhase < 0.5) return invert*(currentPhase*2.0-0.5);
return 0.5-(currentPhase-0.5)*2.0; return invert*(0.5-(currentPhase-0.5)*2.0);
} }
return 0.0; return 0.0;
} }
...@@ -193,7 +203,7 @@ void main(){ ...@@ -193,7 +203,7 @@ void main(){
vec4 quaternion = texture2D(u_lastQuaternion, scaledFragCoord); vec4 quaternion = texture2D(u_lastQuaternion, scaledFragCoord);
vec4 wiring = texture2D(u_wires, scaledFragCoord); vec4 wiring = texture2D(u_wires, scaledFragCoord);
bool isActuator = wiring[0] < -0.5;//-1 int actuatorType = convertToInt(wiring[0]);//>-1 means no actuator
//simple collision //simple collision
float zPosition = texture2D(u_originalPosition, scaledFragCoord).z + translation.z*u_multiplier - u_groundHeight; float zPosition = texture2D(u_originalPosition, scaledFragCoord).z + translation.z*u_multiplier - u_groundHeight;
...@@ -234,33 +244,32 @@ void main(){ ...@@ -234,33 +244,32 @@ void main(){
vec4 neighborQuaternion = texture2D(u_lastQuaternion, scaledNeighborIndex); vec4 neighborQuaternion = texture2D(u_lastQuaternion, scaledNeighborIndex);
vec3 nominalD = neighborOffset(i*3.0+float(j)); vec3 nominalD = neighborOffset(i*3.0+float(j));
vec3 halfNominalD = nominalD/2.0;
float actuation = 0.0;
int _actuatorType = -1;
if (actuatorType<0 && convertToInt(wiring[3]) == neighborAxis) {
_actuatorType = actuatorType;
actuation += 0.3*(getActuatorVoltage(wiring[1]) - getActuatorVoltage(wiring[2]));
} else {
vec4 neighborWiring = texture2D(u_wires, scaledNeighborIndex);
int neighborActuatorType = convertToInt(neighborWiring[0]);//properly wired actuator has type < 0
_actuatorType = neighborActuatorType;
if (neighborActuatorType<0 && convertToInt(neighborWiring[3]) == neighborAxis){
actuation += 0.3*(getActuatorVoltage(neighborWiring[1]) - getActuatorVoltage(neighborWiring[2]));
}
}
vec3 actuatedD = vec3(nominalD[0], nominalD[1], nominalD[2]);
for (int _i=0;_i<3;_i++){
if (_i != neighborAxis) continue;
if (_actuatorType == -1) actuatedD[_i] *= 1.0+actuation;//linear actuator
else if (_actuatorType == -4) actuatedD[0] += actuatedD[_i]*actuation;//shear x
else if (_actuatorType == -5) actuatedD[1] += actuatedD[_i]*actuation;//shear y
else if (_actuatorType == -6) actuatedD[2] += actuatedD[_i]*actuation;//shear z
}
vec3 halfNominalD = actuatedD/2.0;
vec3 cellHalfNominalD = applyQuaternion(halfNominalD, quaternion);//halfNominalD in cell's reference frame vec3 cellHalfNominalD = applyQuaternion(halfNominalD, quaternion);//halfNominalD in cell's reference frame
vec3 neighborHalfNominalD = applyQuaternion(halfNominalD, neighborQuaternion);//halfNominalD in neighbor's reference frame vec3 neighborHalfNominalD = applyQuaternion(halfNominalD, neighborQuaternion);//halfNominalD in neighbor's reference frame
//vec3 actuatedD = vec3(nominalD[0], nominalD[1], nominalD[2]);
//float actuation = 0.0;
//if (isActuator){
// if (neighborAxis == 0 && wiring[1]>0.1){//>0
// actuation += 0.3*getActuatorVoltage(wiring[1]-1.0);
// } else if (neighborAxis == 1 && wiring[2]>0.1){
// actuation += 0.3*getActuatorVoltage(wiring[2]-1.0);
// } else if (neighborAxis == 2 && wiring[3]>0.1){
// actuation += 0.3*getActuatorVoltage(wiring[3]-1.0);
// }
//}
//vec4 neighborWiring = texture2D(u_wires, scaledNeighborIndex);
//if (neighborWiring[0] < -0.5){
// if (neighborAxis == 0 && neighborWiring[1]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[1]-1.0);
// } else if (neighborAxis == 1 && neighborWiring[2]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[2]-1.0);
// } else if (neighborAxis == 2 && neighborWiring[3]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[3]-1.0);
// }
//}
//if (neighborAxis == 0) actuatedD[0] *= 1.0+actuation;
//else if (neighborAxis == 1) actuatedD[1] *= 1.0+actuation;
//else if (neighborAxis == 2) actuatedD[2] *= 1.0+actuation;
vec2 kIndex = vec2(((fragCoord.x-0.5)*12.0 + 2.0*(i*3.0+float(j)) + 0.5)/(u_textureDim.x*12.0), scaledFragCoord.y); vec2 kIndex = vec2(((fragCoord.x-0.5)*12.0 + 2.0*(i*3.0+float(j)) + 0.5)/(u_textureDim.x*12.0), scaledFragCoord.y);
vec3 translationalK = texture2D(u_compositeKs, kIndex).xyz; vec3 translationalK = texture2D(u_compositeKs, kIndex).xyz;
......
...@@ -162,6 +162,7 @@ int convertToInt(float num){ ...@@ -162,6 +162,7 @@ int convertToInt(float num){
} }
float getActuatorVoltage(float wireIndex){ float getActuatorVoltage(float wireIndex){
vec2 wireCoord = vec2(0.5, (floor(wireIndex+0.001)+0.5)/u_wiresMetaLength); vec2 wireCoord = vec2(0.5, (floor(wireIndex+0.001)+0.5)/u_wiresMetaLength);
vec4 wireMeta = texture2D(u_wiresMeta, wireCoord); vec4 wireMeta = texture2D(u_wiresMeta, wireCoord);
int type = convertToInt(wireMeta[0]); int type = convertToInt(wireMeta[0]);
...@@ -169,25 +170,34 @@ float getActuatorVoltage(float wireIndex){ ...@@ -169,25 +170,34 @@ float getActuatorVoltage(float wireIndex){
//no signal connected //no signal connected
return 0.0; return 0.0;
} }
int polarity = type/4;
type = convertToInt(mod(float(type), 4.0));
float frequency = wireMeta[1]; float frequency = wireMeta[1];
float period = 1.0/frequency; float period = 1.0/frequency;
float phase = wireMeta[2]; float phase = wireMeta[2];
float currentPhase = mod(u_time + phase*period, period)/period; float currentPhase = mod(u_time+phase*period, period)/period;
float invert = 1.0;
if (wireMeta[3] > 0.5) invert = -1.0;
if (polarity > 0) invert = -invert;
if (type == 0){ if (type == 0){
return 0.5*sin(2.0*M_PI*currentPhase); return invert*0.5*sin(2.0*M_PI*currentPhase);
} }
if (type == 1){ if (type == 1){
float pwm = wireMeta[3]; float pwm = wireMeta[3];
if (currentPhase < pwm) return 0.5; if (currentPhase < pwm) return invert*0.5;
return -0.5; return -0.5*invert;
} }
if (type == 2){ if (type == 2){
if (wireMeta[3]>0.5) return 0.5-currentPhase; if (wireMeta[3]>0.5) return invert*(0.5-currentPhase);
return currentPhase-0.5; return invert*(currentPhase-0.5);
} }
if (type == 3){ if (type == 3){
if (currentPhase < 0.5) return currentPhase*2.0-0.5; if (currentPhase < 0.5) return invert*(currentPhase*2.0-0.5);
return 0.5-(currentPhase-0.5)*2.0; return invert*(0.5-(currentPhase-0.5)*2.0);
} }
return 0.0; return 0.0;
} }
...@@ -287,7 +297,7 @@ void main(){ ...@@ -287,7 +297,7 @@ void main(){
vec3 angVelocity = texture2D(u_lastAngVelocity, scaledFragCoord).xyz; vec3 angVelocity = texture2D(u_lastAngVelocity, scaledFragCoord).xyz;
vec4 wiring = texture2D(u_wires, scaledFragCoord); vec4 wiring = texture2D(u_wires, scaledFragCoord);
bool isActuator = wiring[0] < -0.5;//-1 int actuatorType = convertToInt(wiring[0]);//>-1 means no actuator
for (float i=0.0;i<2.0;i+=1.0){ for (float i=0.0;i<2.0;i+=1.0){
...@@ -313,33 +323,32 @@ void main(){ ...@@ -313,33 +323,32 @@ void main(){
vec4 neighborQuaternion = texture2D(u_lastQuaternion, scaledNeighborIndex); vec4 neighborQuaternion = texture2D(u_lastQuaternion, scaledNeighborIndex);
vec3 nominalD = neighborOffset(i*3.0+float(j)); vec3 nominalD = neighborOffset(i*3.0+float(j));
vec3 halfNominalD = nominalD/2.0;
float actuation = 0.0;
int _actuatorType = -1;
if (actuatorType<0 && convertToInt(wiring[3]) == neighborAxis) {
_actuatorType = actuatorType;
actuation += 0.3*(getActuatorVoltage(wiring[1]) - getActuatorVoltage(wiring[2]));
} else {
vec4 neighborWiring = texture2D(u_wires, scaledNeighborIndex);
int neighborActuatorType = convertToInt(neighborWiring[0]);//properly wired actuator has type < 0
_actuatorType = neighborActuatorType;
if (neighborActuatorType<0 && convertToInt(neighborWiring[3]) == neighborAxis){
actuation += 0.3*(getActuatorVoltage(neighborWiring[1]) - getActuatorVoltage(neighborWiring[2]));
}
}
vec3 actuatedD = vec3(nominalD[0], nominalD[1], nominalD[2]);
for (int _i=0;_i<3;_i++){
if (_i != neighborAxis) continue;
if (_actuatorType == -1) actuatedD[_i] *= 1.0+actuation;//linear actuator
else if (_actuatorType == -4) actuatedD[0] += actuatedD[_i]*actuation;//shear x
else if (_actuatorType == -5) actuatedD[1] += actuatedD[_i]*actuation;//shear y
else if (_actuatorType == -6) actuatedD[2] += actuatedD[_i]*actuation;//shear z
}
vec3 halfNominalD = actuatedD/2.0;
vec3 cellHalfNominalD = applyQuaternion(halfNominalD, quaternion);//halfNominalD in cell's reference frame vec3 cellHalfNominalD = applyQuaternion(halfNominalD, quaternion);//halfNominalD in cell's reference frame
vec3 neighborHalfNominalD = applyQuaternion(halfNominalD, neighborQuaternion);//halfNominalD in neighbor's reference frame vec3 neighborHalfNominalD = applyQuaternion(halfNominalD, neighborQuaternion);//halfNominalD in neighbor's reference frame
//vec3 actuatedD = vec3(nominalD[0], nominalD[1], nominalD[2]);
//float actuation = 0.0;
//if (isActuator){
// if (neighborAxis == 0 && wiring[1]>0.1){//>0
// actuation += 0.3*getActuatorVoltage(wiring[1]-1.0);
// } else if (neighborAxis == 1 && wiring[2]>0.1){
// actuation += 0.3*getActuatorVoltage(wiring[2]-1.0);
// } else if (neighborAxis == 2 && wiring[3]>0.1){
// actuation += 0.3*getActuatorVoltage(wiring[3]-1.0);
// }
//}
//vec4 neighborWiring = texture2D(u_wires, scaledNeighborIndex);
//if (neighborWiring[0] < -0.5){
// if (neighborAxis == 0 && neighborWiring[1]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[1]-1.0);
// } else if (neighborAxis == 1 && neighborWiring[2]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[2]-1.0);
// } else if (neighborAxis == 2 && neighborWiring[3]>0.1){
// actuation += 0.3*getActuatorVoltage(neighborWiring[3]-1.0);
// }
//}
//if (neighborAxis == 0) actuatedD[0] *= 1.0+actuation;
//else if (neighborAxis == 1) actuatedD[1] *= 1.0+actuation;
//else if (neighborAxis == 2) actuatedD[2] *= 1.0+actuation;
float kPosition = ((fragCoord.x-0.5)*12.0 + 2.0*(i*3.0+float(j)) + 0.5); float kPosition = ((fragCoord.x-0.5)*12.0 + 2.0*(i*3.0+float(j)) + 0.5);
vec2 kIndex = vec2(kPosition/(u_textureDim.x*12.0), scaledFragCoord.y); vec2 kIndex = vec2(kPosition/(u_textureDim.x*12.0), scaledFragCoord.y);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment