Skip to content

Commit

Permalink
TVB-2369 Fix wrong sphere buffers generated for the internal sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
kimonoki committed Aug 7, 2018
1 parent 5fe31f9 commit 2e0b706
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
7 changes: 6 additions & 1 deletion tvb/interfaces/web/static/js/tvbviz.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,12 @@ tv.plot = {

f.energy_callback = function (data) {
timeselection_energy = data;
changeSphereMeasurePoints_energy();
if (isInternalSensorView) {
VSI_change_energySphericalMeasurePoints()
}
else {
changeSphereMeasurePoints_energy();
}
closeBlockerOverlay();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ function _VSI_bufferAtPoint(p, idx) {
return [bufferVertices, bufferNormals, bufferTriangles, vertexRegionBuffer];
}

function VSI_change_energySphericalMeasurePoints() {
for (let i = 0; i < VS_selectedRegions.length; i++) {
const result = HLPR_sphereBufferAtPoint(gl, measurePoints[i], timeselection_energy[i][currentTimeValue], 12, 12);
const bufferVertices = result[0];
const bufferNormals = result[1];
const bufferTriangles = result[2];
const vertexRegionBuffer = VSI_createColorBufferForSphere(i, bufferVertices.numItems * 3);
measurePointsBuffers[i] = [bufferVertices, bufferNormals, bufferTriangles, vertexRegionBuffer];
}
}

/**
* Method used for creating a color buffer for a cube (measure point).
*/
Expand Down Expand Up @@ -75,5 +86,5 @@ function VSI_StartInternalActivityViewer(baseDatatypeURL, onePageSize, urlTimeLi
_VSI_init_sphericalMeasurePoints();

//pause by default
AG_isStopped = true;;
AG_isStopped = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ function drawBuffers(drawMode, buffersSets, bufferSetsMask, useBlending, cullFac
gl.uniform1i(GL_shaderProgram.useVertexColors, false);
gl.uniform1f(GL_shaderProgram.alphaUniform, 1);

// set sphere color green for the selected channels ones and yellow for the others
// set sphere color green for the selected channels and yellow for the others
if (VS_selectedRegions.includes(i)) {
gl.uniform4f(GL_shaderProgram.materialColor, 0.99, 0.99, 0.0, 1.0);
drawBuffer(drawMode, buffersSets[i]);
Expand Down Expand Up @@ -1112,7 +1112,12 @@ function tick() {

//update energy
if(timeselection_interval!=0 && !AG_isStopped){
changeSphereMeasurePoints_energy();
if(isInternalSensorView){
VSI_change_energySphericalMeasurePoints()
}
else{
changeSphereMeasurePoints_energy();
}
}
drawScene();

Expand Down Expand Up @@ -1184,9 +1189,10 @@ function drawScene() {
}

if (isInternalSensorView) {
gl.uniform1f(GL_shaderProgram.alphaUniform, 1);
// for internal sensors we render only the sensors
drawBuffers(gl.TRIANGLES, measurePointsBuffers);
} else {
}
else {
//draw the nodes first to make it appear
if (displayMeasureNodes) {
isDrawingSpheres = true;
Expand Down Expand Up @@ -1419,4 +1425,5 @@ function changeSphereMeasurePoints_energy() {
measurePointsBuffers[i] = [bufferVertices, bufferNormals, bufferTriangles, bufferColor];
}
}

/////////////////////////////////////// ~~~~~~~~~~ END ENERGY RELATED METHOD ~~~~~~~~~~~~~ //////////////////////////////////

0 comments on commit 2e0b706

Please sign in to comment.