Molecular Modeling Software
リビジョン | bfddb708b2491c57b0595383c7f5b20abf4fd70f (tree) |
---|---|
日時 | 2014-11-17 00:47:03 |
作者 | toshinagata1964 <toshinagata1964@a2be...> |
コミッター | toshinagata1964 |
Handling of the surface normals was incomplete. Fixed.
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@587 a2be9bc6-48de-4e38-9406-05402d4bc13c
@@ -1858,6 +1858,7 @@ MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf) | ||
1858 | 1858 | break; |
1859 | 1859 | if (mp->mview == NULL) |
1860 | 1860 | continue; /* Skip */ |
1861 | + redo: | |
1861 | 1862 | if (strcmp(buf, "line\n") == 0) { |
1862 | 1863 | ibuf[0] = kMainViewGraphicLine; |
1863 | 1864 | } else if (strcmp(buf, "poly\n") == 0) { |
@@ -1918,12 +1919,12 @@ MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf) | ||
1918 | 1919 | } |
1919 | 1920 | if (j > 0) |
1920 | 1921 | NewArray(&gp->normals, &gp->nnormals, sizeof(GLfloat) * 3, j); |
1921 | - } else if (i >= gp->npoints + 3 && i < gp->npoints + gp->nnormals + 3) { | |
1922 | + } else if (i >= gp->npoints + 4 && i < gp->npoints + gp->nnormals + 4) { | |
1922 | 1923 | if (sscanf(buf, "%lf %lf %lf", &dbuf[0], &dbuf[1], &dbuf[2]) < 3) { |
1923 | 1924 | s_append_asprintf(errbuf, "line %d: the normal vector cannot be read for graphic object", lineNumber); |
1924 | 1925 | goto err_exit; |
1925 | 1926 | } |
1926 | - j = (i - gp->npoints - 3) * 3; | |
1927 | + j = (i - gp->npoints - 4) * 3; | |
1927 | 1928 | gp->normals[j++] = dbuf[0]; |
1928 | 1929 | gp->normals[j++] = dbuf[1]; |
1929 | 1930 | gp->normals[j] = dbuf[2]; |
@@ -1932,8 +1933,9 @@ MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf) | ||
1932 | 1933 | } |
1933 | 1934 | MainView_insertGraphic(mp->mview, -1, gp); |
1934 | 1935 | free(gp); |
1935 | - if (buf[0] == '\n') | |
1936 | + if (buf[0] == '\n' || buf[0] == 0) | |
1936 | 1937 | break; |
1938 | + goto redo; | |
1937 | 1939 | } |
1938 | 1940 | continue; |
1939 | 1941 | } else if (strncmp(buf, "!:@", 3) == 0) { |