Skip to content

Commit

Permalink
Second approximation to modularization + compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
blokhin committed Aug 5, 2015
1 parent 0c44353 commit e065e15
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 1,005 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/libs/*.custom.js
3 changes: 3 additions & 0 deletions KNOWN_BUGS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Balls are rotated incorrectly while rendering
Window resize doesn't work properly
Atoms are neither translated nor recreated by symmetry
CIF frames not supported
Phonon visualization with tween.js temporarily dropped
Labels temporarily dropped
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Materials Informatics Player
======

Browser-based renderer of the [crystallographic information files (CIF)](https://en.wikipedia.org/wiki/Crystallographic_Information_File) written in a pure javascript.
Requires some web-server to run.
Browser-based modular (though minimalistic) renderer of the [crystallographic information files (CIF)](https://en.wikipedia.org/wiki/Crystallographic_Information_File) written in a pure javascript.
Requires some web-server (preferably, Python- or PHP-powered) to run.

E.g. if Python available:
E.g. for Python:
```shell
python proxy.py 7777
```
Expand All @@ -14,8 +14,11 @@ Or using an internal web-server in PHP:
php -S localhost:7777
```

GUI is then accessible via the local address http://localhost:7777/ in the browser (or other address, depending on used server).
GUI is then accessible in the browser via the [localhost address](http://localhost:7777) (or other address, depending on used server).
See [online](https://tilde.pro/player.html).


To display a local CIF file, drag and drop it inside the browser window.
To display a CIF file on the web, paste its web address in the browser's address bar, after sharp (#) symbol and hit enter. (PHP or Python proxy for javascript requests should be then used.)
To display a remote CIF file on the web, paste its web address in the browser's address bar, after sharp (#) symbol and hit enter. (PHP or Python proxy for remote requests should be then used.)

Two external javascript libraries ([three.js](https://github.com/mrdoob/three.js) and [math.js](http://mathjs.org)) are embedded.
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

if [[! -d "three.js" ]]; then
sh prepare.sh
fi

cd src/js/app
webpack --config build.config.js main.js ../../../player.dist.js
cd ../../../
java -jar three.js/utils/build/compiler/compiler.jar --jscomp_off checkTypes --language_in ECMASCRIPT5_STRICT --js player.dist.js --js_output_file player.min.js
rm player.dist.js
cp src/index.html index.html

echo "Compiled successfully"

exit 0
5 changes: 0 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
</style>
</head>
<body>
<script type="text/javascript" src="js/deps/three.custom.min.js"></script>
<!--script type="text/javascript" src="stats.min.js"></script-->
<script type="text/javascript" src="js/deps/tween.min.js"></script>
<script type="text/javascript" src="js/app/polyfills.js"></script>
<script type="text/javascript" src="js/app/chemical_elements.js"></script>
<script type="text/javascript" data-main="js/app/main" src="js/deps/require.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions js/app/build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var path = require('path');

module.exports = {
resolve: {
root: path.resolve('.'),
extensions: ['', '.js'],
alias: {
'deps/math.custom': '../deps/math.custom',
'deps/three.custom': '../deps/three.custom'
}
}
}
10 changes: 7 additions & 3 deletions js/app/chemical_elements.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e065e15

Please sign in to comment.