web chemdoodle定制网格

时间:2015-04-24 14:57:38

标签: javascript browser webgl

我从(web.chemdoodle.com)

下载了Chemdoodle Web组件

以下是我从网站上获取的工作示例代码。我想了解API中的_Mesh类以及如何创建自己的Mesh并将其放在该分子上。也许是第一个盒子或类似但没有盒子功能的盒子(后面我想用自己的顶点和面改变自定义网格中的盒子)

<html>
<head>
<script type="text/javascript" src="../install/ChemDoodleWeb-libs.js"></script>
<script type="text/javascript" src="../install/ChemDoodleWeb.js"></script>
<title>3D ChemDoodle Web Component using WebGL : Interactive Model ofDDT</title>
</head>
<body>

</body>
</html>

<script>
  var transformerDistance = new ChemDoodle.TransformCanvas3D('transformDistance', 300, 300);
  // set up visual specifications
  transformerDistance.specs.set3DRepresentation('Ball and Stick');
  transformerDistance.specs.backgroundColor = 'black';
  transformerDistance.specs.atoms_displayLabels_3D = true;
  transformerDistance.specs.shapes_color = '#fff';
  // read in a water molecule
  var water = new ChemDoodle.io.JSONInterpreter().molFrom({"a":[{"x":0,"y":-0.2633,"i":"a0","l":"O"},{"x":-0.8109999999999999,"y":0.2633,"i":"a1","l":"H"},{"x":0.8109999999999999,"y":0.2633,"i":"a2","l":"H"}],"b":[{"b":0,"e":1,"i":"b0"},{"b":0,"e":2,"i":"b1"}]});
  // create a distance object between the hydrogen atoms
  var distance = new ChemDoodle.structures.d3.Distance(water.atoms[1], water.atoms[2]);
  // add the objects to the scene
</script>

0 个答案:

没有答案