Commit a899b46e authored by Ruben Jesus Garcia Hernandez's avatar Ruben Jesus Garcia Hernandez
Browse files

Scale volumetric data according to unit cell if present.

Useful for time evolution data (conversion from cube to xyz)
parent 342eb562
......@@ -387,12 +387,17 @@ bool er;
plyfiles[p % ISOS]);
float mat[16];
glm::mat4 matFinal, matcubetrans, mvs, sc, sctrans;
if (voxelSize[0]!=-1) {
if (voxelSize[0]!=-1 || has_abc) {
//We scale in RenderUnitCell by globalscaling so that atoms look large enough on the cave.
//So we need to scale here as well.
mvs=glm::scale(mvs, glm::vec3(globalscaling*scaling / (float)voxelSize[0],
if (voxelSize[0]!=-1)
mvs=glm::scale(mvs,
glm::vec3(globalscaling*scaling / (float)voxelSize[0],
globalscaling*scaling / (float)voxelSize[1],
globalscaling*scaling / (float)voxelSize[2]));
else
mvs=glm::scale(mvs, glm::vec3(globalscaling*scaling,
globalscaling*scaling, globalscaling*scaling));
matcubetrans=glm::translate(matcubetrans,glm::vec3(cubetrans[0],
cubetrans[1], cubetrans[2]));
glm::mat4 abcm (abc[0][0], abc[0][1], abc[0][2], 0,
......
......@@ -496,10 +496,14 @@ glGenTextures(2+ZLAYERS, textDepthPeeling);
plyfiles[p % ISOS]);
gvr::Mat4f trans;
gvr::Mat4f matFinal, matcubetrans, mvs, sc, sctrans;
if (voxelSize[0]!=-1) {
mvs=ScalingMatrix(scaling/(float)voxelSize[0], scaling/(float)voxelSize[1],
scaling/(float)voxelSize[2]);
if (voxelSize[0]!=-1 || has_abc) {
if (voxelSize[0]==-1)
mvs=ScalingMatrix(scaling);
else
mvs=ScalingMatrix(scaling/(float)voxelSize[0], scaling/(float)voxelSize[1],
scaling/(float)voxelSize[2]);
matcubetrans=TranslationMatrix(cubetrans);
gvr::Mat4f abcm {abc[0][0], abc[0][1], abc[0][2], 0,
abc[1][0], abc[1][1], abc[1][2], 0,
......
......@@ -282,10 +282,13 @@ void OvrApp::OneTimeInit( const char * fromPackage, const char * launchIntentJSO
translations[p%ISOS][2]);
*/
//gvr
if (voxelSize[0]!=-1) {
if (voxelSize[0]!=-1 ||has_abc) {
Matrix4f mvs, abcm, matcubetrans, sctrans, sc;
mvs=Matrix4f::Scaling(scaling/(float)voxelSize[0], scaling/(float)voxelSize[1],
scaling/(float)voxelSize[2]);
if (voxelSize[0]==-1)
mvs=Matrix4f::Scaling(scaling);
else
mvs=Matrix4f::Scaling(scaling/(float)voxelSize[0], scaling/(float)voxelSize[1],
scaling/(float)voxelSize[2]);
matcubetrans=Matrix4f::Translation(cubetrans[0], cubetrans[1], cubetrans[2]);
for (int i=0;i<3;i++) {
......
......@@ -1687,8 +1687,9 @@ void CMainApplication::SetupIsosurfaces()
Matrix4 matFinal;
//matFinal.translate(translations[p%ISOS][0]+cubetrans[0], translations[p%ISOS][1]+cubetrans[1], translations[p%ISOS][2]+cubetrans[2]);
Matrix4 matcubetrans, mvs;
if (voxelSize[0]!=-1) {
mvs.scale(1.0f / (float)voxelSize[0], 1.0f / (float)voxelSize[1], 1.0f / (float)voxelSize[2]);
if (voxelSize[0]!=-1 ||has_abc) {
if (voxelSize[0]!=-1)
mvs.scale(1.0f / (float)voxelSize[0], 1.0f / (float)voxelSize[1], 1.0f / (float)voxelSize[2]);
matcubetrans.translate(cubetrans[0], cubetrans[1], cubetrans[2]); //angstrom
//if abc, in abc coordinates
/*Matrix4 abcm (abc[0][0], abc[1][0], abc[2][0], 0,
......
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