lesson.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // Licensed under a BSD license. See license.html for license
  2. /* eslint-disable strict */
  3. 'use strict'; // eslint-disable-line
  4. /* global jQuery, settings, contributors */
  5. (function($){
  6. function getQueryParams() {
  7. return Object.fromEntries(new URLSearchParams(window.location.search).entries());
  8. }
  9. //
  10. function replaceParams(str, subs) {
  11. return str.replace(/\${(\w+)}/g, function(m, key) {
  12. return subs[key];
  13. });
  14. }
  15. function showContributors() {
  16. // contribTemplate: 'Thank you
  17. // <a href="${html_url}">
  18. // <img src="${avatar_url}">${login}<a/>
  19. // for <a href="https://github.com/${owner}/${repo}/commits?author=${login}">${contributions} contributions</a>',
  20. try {
  21. const subs = {...settings, ...contributors[Math.random() * contributors.length | 0]};
  22. const template = settings.contribTemplate;
  23. const html = replaceParams(template, subs);
  24. const parent = document.querySelector('#forkongithub>div');
  25. const div = document.createElement('div');
  26. div.className = 'contributors';
  27. div.innerHTML = html;
  28. parent.appendChild(div);
  29. } catch (e) {
  30. console.error(e);
  31. }
  32. }
  33. showContributors();
  34. $(document).ready(function($){
  35. const supportedLangs = {
  36. 'en': true,
  37. 'zh': true,
  38. };
  39. function insertLang(codeKeywordLinks) {
  40. const lang = document.documentElement.lang.substr(0, 2).toLowerCase();
  41. const langPart = `#api/${supportedLangs[lang] ? lang : 'en'}/`;
  42. const langAddedLinks = {};
  43. for (const [keyword, url] of Object.entries(codeKeywordLinks)) {
  44. langAddedLinks[keyword] = url.replace('#api/', langPart);
  45. }
  46. return langAddedLinks;
  47. }
  48. const codeKeywordLinks = insertLang({
  49. AnimationAction: 'https://threejs.org/docs/#api/animation/AnimationAction',
  50. AnimationClip: 'https://threejs.org/docs/#api/animation/AnimationClip',
  51. AnimationMixer: 'https://threejs.org/docs/#api/animation/AnimationMixer',
  52. AnimationObjectGroup: 'https://threejs.org/docs/#api/animation/AnimationObjectGroup',
  53. AnimationUtils: 'https://threejs.org/docs/#api/animation/AnimationUtils',
  54. KeyframeTrack: 'https://threejs.org/docs/#api/animation/KeyframeTrack',
  55. PropertyBinding: 'https://threejs.org/docs/#api/animation/PropertyBinding',
  56. PropertyMixer: 'https://threejs.org/docs/#api/animation/PropertyMixer',
  57. BooleanKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/BooleanKeyframeTrack',
  58. ColorKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/ColorKeyframeTrack',
  59. NumberKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/NumberKeyframeTrack',
  60. QuaternionKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/QuaternionKeyframeTrack',
  61. StringKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/StringKeyframeTrack',
  62. VectorKeyframeTrack: 'https://threejs.org/docs/#api/animation/tracks/VectorKeyframeTrack',
  63. Audio: 'https://threejs.org/docs/#api/audio/Audio',
  64. AudioAnalyser: 'https://threejs.org/docs/#api/audio/AudioAnalyser',
  65. AudioContext: 'https://threejs.org/docs/#api/audio/AudioContext',
  66. AudioListener: 'https://threejs.org/docs/#api/audio/AudioListener',
  67. PositionalAudio: 'https://threejs.org/docs/#api/audio/PositionalAudio',
  68. ArrayCamera: 'https://threejs.org/docs/#api/cameras/ArrayCamera',
  69. Camera: 'https://threejs.org/docs/#api/cameras/Camera',
  70. CubeCamera: 'https://threejs.org/docs/#api/cameras/CubeCamera',
  71. OrthographicCamera: 'https://threejs.org/docs/#api/cameras/OrthographicCamera',
  72. PerspectiveCamera: 'https://threejs.org/docs/#api/cameras/PerspectiveCamera',
  73. StereoCamera: 'https://threejs.org/docs/#api/cameras/StereoCamera',
  74. Animation: 'https://threejs.org/docs/#api/constants/Animation',
  75. Core: 'https://threejs.org/docs/#api/constants/Core',
  76. CustomBlendingEquation: 'https://threejs.org/docs/#api/constants/CustomBlendingEquations',
  77. DrawModes: 'https://threejs.org/docs/#api/constants/DrawModes',
  78. Materials: 'https://threejs.org/docs/#api/constants/Materials',
  79. Renderer: 'https://threejs.org/docs/#api/constants/Renderer',
  80. Textures: 'https://threejs.org/docs/#api/constants/Textures',
  81. BufferAttribute: 'https://threejs.org/docs/#api/core/BufferAttribute',
  82. BufferGeometry: 'https://threejs.org/docs/#api/core/BufferGeometry',
  83. Clock: 'https://threejs.org/docs/#api/core/Clock',
  84. DirectGeometry: 'https://threejs.org/docs/#api/core/DirectGeometry',
  85. EventDispatcher: 'https://threejs.org/docs/#api/core/EventDispatcher',
  86. Face3: 'https://threejs.org/docs/#api/core/Face3',
  87. Geometry: 'https://threejs.org/docs/#api/core/Geometry',
  88. InstancedBufferAttribute: 'https://threejs.org/docs/#api/core/InstancedBufferAttribute',
  89. InstancedBufferGeometry: 'https://threejs.org/docs/#api/core/InstancedBufferGeometry',
  90. InstancedInterleavedBuffer: 'https://threejs.org/docs/#api/core/InstancedInterleavedBuffer',
  91. InterleavedBuffer: 'https://threejs.org/docs/#api/core/InterleavedBuffer',
  92. InterleavedBufferAttribute: 'https://threejs.org/docs/#api/core/InterleavedBufferAttribute',
  93. Layers: 'https://threejs.org/docs/#api/core/Layers',
  94. Object3D: 'https://threejs.org/docs/#api/core/Object3D',
  95. Raycaster: 'https://threejs.org/docs/#api/core/Raycaster',
  96. Uniform: 'https://threejs.org/docs/#api/core/Uniform',
  97. BufferAttributeTypes: 'https://threejs.org/docs/#api/core/bufferAttributeTypes/BufferAttributeTypes',
  98. Earcut: 'https://threejs.org/docs/#api/extras/Earcut',
  99. ShapeUtils: 'https://threejs.org/docs/#api/extras/ShapeUtils',
  100. Curve: 'https://threejs.org/docs/#api/extras/core/Curve',
  101. CurvePath: 'https://threejs.org/docs/#api/extras/core/CurvePath',
  102. Font: 'https://threejs.org/docs/#api/extras/core/Font',
  103. Interpolations: 'https://threejs.org/docs/#api/extras/core/Interpolations',
  104. Path: 'https://threejs.org/docs/#api/extras/core/Path',
  105. Shape: 'https://threejs.org/docs/#api/extras/core/Shape',
  106. ShapePath: 'https://threejs.org/docs/#api/extras/core/ShapePath',
  107. ArcCurve: 'https://threejs.org/docs/#api/extras/curves/ArcCurve',
  108. CatmullRomCurve3: 'https://threejs.org/docs/#api/extras/curves/CatmullRomCurve3',
  109. CubicBezierCurve: 'https://threejs.org/docs/#api/extras/curves/CubicBezierCurve',
  110. CubicBezierCurve3: 'https://threejs.org/docs/#api/extras/curves/CubicBezierCurve3',
  111. EllipseCurve: 'https://threejs.org/docs/#api/extras/curves/EllipseCurve',
  112. LineCurve: 'https://threejs.org/docs/#api/extras/curves/LineCurve',
  113. LineCurve3: 'https://threejs.org/docs/#api/extras/curves/LineCurve3',
  114. QuadraticBezierCurve: 'https://threejs.org/docs/#api/extras/curves/QuadraticBezierCurve',
  115. QuadraticBezierCurve3: 'https://threejs.org/docs/#api/extras/curves/QuadraticBezierCurve3',
  116. SplineCurve: 'https://threejs.org/docs/#api/extras/curves/SplineCurve',
  117. ImmediateRenderObject: 'https://threejs.org/docs/#api/extras/objects/ImmediateRenderObject',
  118. BoxBufferGeometry: 'https://threejs.org/docs/#api/geometries/BoxBufferGeometry',
  119. BoxGeometry: 'https://threejs.org/docs/#api/geometries/BoxGeometry',
  120. CircleBufferGeometry: 'https://threejs.org/docs/#api/geometries/CircleBufferGeometry',
  121. CircleGeometry: 'https://threejs.org/docs/#api/geometries/CircleGeometry',
  122. ConeBufferGeometry: 'https://threejs.org/docs/#api/geometries/ConeBufferGeometry',
  123. ConeGeometry: 'https://threejs.org/docs/#api/geometries/ConeGeometry',
  124. CylinderBufferGeometry: 'https://threejs.org/docs/#api/geometries/CylinderBufferGeometry',
  125. CylinderGeometry: 'https://threejs.org/docs/#api/geometries/CylinderGeometry',
  126. DodecahedronBufferGeometry: 'https://threejs.org/docs/#api/geometries/DodecahedronBufferGeometry',
  127. DodecahedronGeometry: 'https://threejs.org/docs/#api/geometries/DodecahedronGeometry',
  128. EdgesGeometry: 'https://threejs.org/docs/#api/geometries/EdgesGeometry',
  129. ExtrudeBufferGeometry: 'https://threejs.org/docs/#api/geometries/ExtrudeBufferGeometry',
  130. ExtrudeGeometry: 'https://threejs.org/docs/#api/geometries/ExtrudeGeometry',
  131. IcosahedronBufferGeometry: 'https://threejs.org/docs/#api/geometries/IcosahedronBufferGeometry',
  132. IcosahedronGeometry: 'https://threejs.org/docs/#api/geometries/IcosahedronGeometry',
  133. LatheBufferGeometry: 'https://threejs.org/docs/#api/geometries/LatheBufferGeometry',
  134. LatheGeometry: 'https://threejs.org/docs/#api/geometries/LatheGeometry',
  135. OctahedronBufferGeometry: 'https://threejs.org/docs/#api/geometries/OctahedronBufferGeometry',
  136. OctahedronGeometry: 'https://threejs.org/docs/#api/geometries/OctahedronGeometry',
  137. ParametricBufferGeometry: 'https://threejs.org/docs/#api/geometries/ParametricBufferGeometry',
  138. ParametricGeometry: 'https://threejs.org/docs/#api/geometries/ParametricGeometry',
  139. PlaneBufferGeometry: 'https://threejs.org/docs/#api/geometries/PlaneBufferGeometry',
  140. PlaneGeometry: 'https://threejs.org/docs/#api/geometries/PlaneGeometry',
  141. PolyhedronBufferGeometry: 'https://threejs.org/docs/#api/geometries/PolyhedronBufferGeometry',
  142. PolyhedronGeometry: 'https://threejs.org/docs/#api/geometries/PolyhedronGeometry',
  143. RingBufferGeometry: 'https://threejs.org/docs/#api/geometries/RingBufferGeometry',
  144. RingGeometry: 'https://threejs.org/docs/#api/geometries/RingGeometry',
  145. ShapeBufferGeometry: 'https://threejs.org/docs/#api/geometries/ShapeBufferGeometry',
  146. ShapeGeometry: 'https://threejs.org/docs/#api/geometries/ShapeGeometry',
  147. SphereBufferGeometry: 'https://threejs.org/docs/#api/geometries/SphereBufferGeometry',
  148. SphereGeometry: 'https://threejs.org/docs/#api/geometries/SphereGeometry',
  149. TetrahedronBufferGeometry: 'https://threejs.org/docs/#api/geometries/TetrahedronBufferGeometry',
  150. TetrahedronGeometry: 'https://threejs.org/docs/#api/geometries/TetrahedronGeometry',
  151. TextBufferGeometry: 'https://threejs.org/docs/#api/geometries/TextBufferGeometry',
  152. TextGeometry: 'https://threejs.org/docs/#api/geometries/TextGeometry',
  153. TorusBufferGeometry: 'https://threejs.org/docs/#api/geometries/TorusBufferGeometry',
  154. TorusGeometry: 'https://threejs.org/docs/#api/geometries/TorusGeometry',
  155. TorusKnotBufferGeometry: 'https://threejs.org/docs/#api/geometries/TorusKnotBufferGeometry',
  156. TorusKnotGeometry: 'https://threejs.org/docs/#api/geometries/TorusKnotGeometry',
  157. TubeBufferGeometry: 'https://threejs.org/docs/#api/geometries/TubeBufferGeometry',
  158. TubeGeometry: 'https://threejs.org/docs/#api/geometries/TubeGeometry',
  159. WireframeGeometry: 'https://threejs.org/docs/#api/geometries/WireframeGeometry',
  160. ArrowHelper: 'https://threejs.org/docs/#api/helpers/ArrowHelper',
  161. AxesHelper: 'https://threejs.org/docs/#api/helpers/AxesHelper',
  162. BoxHelper: 'https://threejs.org/docs/#api/helpers/BoxHelper',
  163. Box3Helper: 'https://threejs.org/docs/#api/helpers/Box3Helper',
  164. CameraHelper: 'https://threejs.org/docs/#api/helpers/CameraHelper',
  165. DirectionalLightHelper: 'https://threejs.org/docs/#api/helpers/DirectionalLightHelper',
  166. FaceNormalsHelper: 'https://threejs.org/docs/#api/helpers/FaceNormalsHelper',
  167. GridHelper: 'https://threejs.org/docs/#api/helpers/GridHelper',
  168. PolarGridHelper: 'https://threejs.org/docs/#api/helpers/PolarGridHelper',
  169. HemisphereLightHelper: 'https://threejs.org/docs/#api/helpers/HemisphereLightHelper',
  170. PlaneHelper: 'https://threejs.org/docs/#api/helpers/PlaneHelper',
  171. PointLightHelper: 'https://threejs.org/docs/#api/helpers/PointLightHelper',
  172. RectAreaLightHelper: 'https://threejs.org/docs/#api/helpers/RectAreaLightHelper',
  173. SkeletonHelper: 'https://threejs.org/docs/#api/helpers/SkeletonHelper',
  174. SpotLightHelper: 'https://threejs.org/docs/#api/helpers/SpotLightHelper',
  175. VertexNormalsHelper: 'https://threejs.org/docs/#api/helpers/VertexNormalsHelper',
  176. AmbientLight: 'https://threejs.org/docs/#api/lights/AmbientLight',
  177. DirectionalLight: 'https://threejs.org/docs/#api/lights/DirectionalLight',
  178. HemisphereLight: 'https://threejs.org/docs/#api/lights/HemisphereLight',
  179. Light: 'https://threejs.org/docs/#api/lights/Light',
  180. PointLight: 'https://threejs.org/docs/#api/lights/PointLight',
  181. RectAreaLight: 'https://threejs.org/docs/#api/lights/RectAreaLight',
  182. SpotLight: 'https://threejs.org/docs/#api/lights/SpotLight',
  183. DirectionalLightShadow: 'https://threejs.org/docs/#api/lights/shadows/DirectionalLightShadow',
  184. LightShadow: 'https://threejs.org/docs/#api/lights/shadows/LightShadow',
  185. SpotLightShadow: 'https://threejs.org/docs/#api/lights/shadows/SpotLightShadow',
  186. AnimationLoader: 'https://threejs.org/docs/#api/loaders/AnimationLoader',
  187. AudioLoader: 'https://threejs.org/docs/#api/loaders/AudioLoader',
  188. BufferGeometryLoader: 'https://threejs.org/docs/#api/loaders/BufferGeometryLoader',
  189. Cache: 'https://threejs.org/docs/#api/loaders/Cache',
  190. CompressedTextureLoader: 'https://threejs.org/docs/#api/loaders/CompressedTextureLoader',
  191. CubeTextureLoader: 'https://threejs.org/docs/#api/loaders/CubeTextureLoader',
  192. DataTextureLoader: 'https://threejs.org/docs/#api/loaders/DataTextureLoader',
  193. FileLoader: 'https://threejs.org/docs/#api/loaders/FileLoader',
  194. FontLoader: 'https://threejs.org/docs/#api/loaders/FontLoader',
  195. ImageBitmapLoader: 'https://threejs.org/docs/#api/loaders/ImageBitmapLoader',
  196. ImageLoader: 'https://threejs.org/docs/#api/loaders/ImageLoader',
  197. JSONLoader: 'https://threejs.org/docs/#api/loaders/JSONLoader',
  198. Loader: 'https://threejs.org/docs/#api/loaders/Loader',
  199. LoaderUtils: 'https://threejs.org/docs/#api/loaders/LoaderUtils',
  200. MaterialLoader: 'https://threejs.org/docs/#api/loaders/MaterialLoader',
  201. ObjectLoader: 'https://threejs.org/docs/#api/loaders/ObjectLoader',
  202. TextureLoader: 'https://threejs.org/docs/#api/loaders/TextureLoader',
  203. DefaultLoadingManager: 'https://threejs.org/docs/#api/loaders/managers/DefaultLoadingManager',
  204. LoadingManager: 'https://threejs.org/docs/#api/loaders/managers/LoadingManager',
  205. LineBasicMaterial: 'https://threejs.org/docs/#api/materials/LineBasicMaterial',
  206. LineDashedMaterial: 'https://threejs.org/docs/#api/materials/LineDashedMaterial',
  207. Material: 'https://threejs.org/docs/#api/materials/Material',
  208. MeshBasicMaterial: 'https://threejs.org/docs/#api/materials/MeshBasicMaterial',
  209. MeshDepthMaterial: 'https://threejs.org/docs/#api/materials/MeshDepthMaterial',
  210. MeshLambertMaterial: 'https://threejs.org/docs/#api/materials/MeshLambertMaterial',
  211. MeshNormalMaterial: 'https://threejs.org/docs/#api/materials/MeshNormalMaterial',
  212. MeshPhongMaterial: 'https://threejs.org/docs/#api/materials/MeshPhongMaterial',
  213. MeshPhysicalMaterial: 'https://threejs.org/docs/#api/materials/MeshPhysicalMaterial',
  214. MeshStandardMaterial: 'https://threejs.org/docs/#api/materials/MeshStandardMaterial',
  215. MeshToonMaterial: 'https://threejs.org/docs/#api/materials/MeshToonMaterial',
  216. PointsMaterial: 'https://threejs.org/docs/#api/materials/PointsMaterial',
  217. RawShaderMaterial: 'https://threejs.org/docs/#api/materials/RawShaderMaterial',
  218. ShaderMaterial: 'https://threejs.org/docs/#api/materials/ShaderMaterial',
  219. ShadowMaterial: 'https://threejs.org/docs/#api/materials/ShadowMaterial',
  220. SpriteMaterial: 'https://threejs.org/docs/#api/materials/SpriteMaterial',
  221. Box2: 'https://threejs.org/docs/#api/math/Box2',
  222. Box3: 'https://threejs.org/docs/#api/math/Box3',
  223. Color: 'https://threejs.org/docs/#api/math/Color',
  224. Cylindrical: 'https://threejs.org/docs/#api/math/Cylindrical',
  225. Euler: 'https://threejs.org/docs/#api/math/Euler',
  226. Frustum: 'https://threejs.org/docs/#api/math/Frustum',
  227. Interpolant: 'https://threejs.org/docs/#api/math/Interpolant',
  228. Line3: 'https://threejs.org/docs/#api/math/Line3',
  229. Math: 'https://threejs.org/docs/#api/math/Math',
  230. Matrix3: 'https://threejs.org/docs/#api/math/Matrix3',
  231. Matrix4: 'https://threejs.org/docs/#api/math/Matrix4',
  232. Plane: 'https://threejs.org/docs/#api/math/Plane',
  233. Quaternion: 'https://threejs.org/docs/#api/math/Quaternion',
  234. Ray: 'https://threejs.org/docs/#api/math/Ray',
  235. Sphere: 'https://threejs.org/docs/#api/math/Sphere',
  236. Spherical: 'https://threejs.org/docs/#api/math/Spherical',
  237. Triangle: 'https://threejs.org/docs/#api/math/Triangle',
  238. Vector2: 'https://threejs.org/docs/#api/math/Vector2',
  239. Vector3: 'https://threejs.org/docs/#api/math/Vector3',
  240. Vector4: 'https://threejs.org/docs/#api/math/Vector4',
  241. CubicInterpolant: 'https://threejs.org/docs/#api/math/interpolants/CubicInterpolant',
  242. DiscreteInterpolant: 'https://threejs.org/docs/#api/math/interpolants/DiscreteInterpolant',
  243. LinearInterpolant: 'https://threejs.org/docs/#api/math/interpolants/LinearInterpolant',
  244. QuaternionLinearInterpolant: 'https://threejs.org/docs/#api/math/interpolants/QuaternionLinearInterpolant',
  245. Bone: 'https://threejs.org/docs/#api/objects/Bone',
  246. Group: 'https://threejs.org/docs/#api/objects/Group',
  247. Line: 'https://threejs.org/docs/#api/objects/Line',
  248. LineLoop: 'https://threejs.org/docs/#api/objects/LineLoop',
  249. LineSegments: 'https://threejs.org/docs/#api/objects/LineSegments',
  250. LOD: 'https://threejs.org/docs/#api/objects/LOD',
  251. Mesh: 'https://threejs.org/docs/#api/objects/Mesh',
  252. Points: 'https://threejs.org/docs/#api/objects/Points',
  253. Skeleton: 'https://threejs.org/docs/#api/objects/Skeleton',
  254. SkinnedMesh: 'https://threejs.org/docs/#api/objects/SkinnedMesh',
  255. Sprite: 'https://threejs.org/docs/#api/objects/Sprite',
  256. WebGLRenderer: 'https://threejs.org/docs/#api/renderers/WebGLRenderer',
  257. WebGLRenderTarget: 'https://threejs.org/docs/#api/renderers/WebGLRenderTarget',
  258. WebGLCubeRenderTarget: 'https://threejs.org/docs/#api/renderers/WebGLCubeRenderTarget',
  259. ShaderChunk: 'https://threejs.org/docs/#api/renderers/shaders/ShaderChunk',
  260. ShaderLib: 'https://threejs.org/docs/#api/renderers/shaders/ShaderLib',
  261. UniformsLib: 'https://threejs.org/docs/#api/renderers/shaders/UniformsLib',
  262. UniformsUtils: 'https://threejs.org/docs/#api/renderers/shaders/UniformsUtils',
  263. Fog: 'https://threejs.org/docs/#api/scenes/Fog',
  264. FogExp2: 'https://threejs.org/docs/#api/scenes/FogExp2',
  265. Scene: 'https://threejs.org/docs/#api/scenes/Scene',
  266. CanvasTexture: 'https://threejs.org/docs/#api/textures/CanvasTexture',
  267. CompressedTexture: 'https://threejs.org/docs/#api/textures/CompressedTexture',
  268. CubeTexture: 'https://threejs.org/docs/#api/textures/CubeTexture',
  269. DataTexture: 'https://threejs.org/docs/#api/textures/DataTexture',
  270. DepthTexture: 'https://threejs.org/docs/#api/textures/DepthTexture',
  271. Texture: 'https://threejs.org/docs/#api/textures/Texture',
  272. VideoTexture: 'https://threejs.org/docs/#api/textures/VideoTexture',
  273. CCDIKSolver: 'https://threejs.org/docs/#examples/animations/CCDIKSolver',
  274. MMDAnimationHelper: 'https://threejs.org/docs/#examples/animations/MMDAnimationHelper',
  275. MMDPhysics: 'https://threejs.org/docs/#examples/animations/MMDPhysics',
  276. OrbitControls: 'https://threejs.org/docs/#examples/controls/OrbitControls',
  277. ConvexBufferGeometry: 'https://threejs.org/docs/#examples/geometries/ConvexBufferGeometry',
  278. ConvexGeometry: 'https://threejs.org/docs/#examples/geometries/ConvexGeometry',
  279. DecalGeometry: 'https://threejs.org/docs/#examples/geometries/DecalGeometry',
  280. BabylonLoader: 'https://threejs.org/docs/#examples/loaders/BabylonLoader',
  281. GLTFLoader: 'https://threejs.org/docs/#examples/loaders/GLTFLoader',
  282. MMDLoader: 'https://threejs.org/docs/#examples/loaders/MMDLoader',
  283. MTLLoader: 'https://threejs.org/docs/#examples/loaders/MTLLoader',
  284. OBJLoader: 'https://threejs.org/docs/#examples/loaders/OBJLoader',
  285. OBJLoader2: 'https://threejs.org/docs/#examples/loaders/OBJLoader2',
  286. LoaderSupport: 'https://threejs.org/docs/#examples/loaders/LoaderSupport',
  287. PCDLoader: 'https://threejs.org/docs/#examples/loaders/PCDLoader',
  288. PDBLoader: 'https://threejs.org/docs/#examples/loaders/PDBLoader',
  289. SVGLoader: 'https://threejs.org/docs/#examples/loaders/SVGLoader',
  290. TGALoader: 'https://threejs.org/docs/#examples/loaders/TGALoader',
  291. PRWMLoader: 'https://threejs.org/docs/#examples/loaders/PRWMLoader',
  292. Lensflare: 'https://threejs.org/docs/#examples/objects/Lensflare',
  293. GLTFExporter: 'https://threejs.org/docs/#examples/exporters/GLTFExporter',
  294. });
  295. function getKeywordLink(keyword) {
  296. const dotNdx = keyword.indexOf('.');
  297. if (dotNdx) {
  298. const before = keyword.substring(0, dotNdx);
  299. const link = codeKeywordLinks[before];
  300. if (link) {
  301. return `${link}.${keyword.substr(dotNdx + 1)}`;
  302. }
  303. }
  304. return keyword.startsWith('THREE.')
  305. ? codeKeywordLinks[keyword.substring(6)]
  306. : codeKeywordLinks[keyword];
  307. }
  308. $('code').filter(function() {
  309. return getKeywordLink(this.textContent) &&
  310. this.parentElement.nodeName !== 'A';
  311. }).wrap(function() {
  312. const a = document.createElement('a');
  313. a.href = getKeywordLink(this.textContent);
  314. return a;
  315. });
  316. const methodPropertyRE = /^(\w+)\.(\w+)$/;
  317. const classRE = /^(\w+)$/;
  318. $('a').each(function() {
  319. const href = this.getAttribute('href');
  320. if (!href) {
  321. return;
  322. }
  323. const m = methodPropertyRE.exec(href);
  324. if (m) {
  325. const codeKeywordLink = getKeywordLink(m[1]);
  326. if (codeKeywordLink) {
  327. this.setAttribute('href', `${codeKeywordLink}#${m[2]}`);
  328. }
  329. } else if (classRE.test(href)) {
  330. const codeKeywordLink = getKeywordLink(href);
  331. if (codeKeywordLink) {
  332. this.setAttribute('href', codeKeywordLink);
  333. }
  334. }
  335. });
  336. const linkImgs = function(bigHref) {
  337. return function() {
  338. const a = document.createElement('a');
  339. a.href = bigHref;
  340. a.title = this.alt;
  341. a.className = this.className;
  342. a.setAttribute('align', this.align);
  343. this.setAttribute('align', '');
  344. this.className = '';
  345. this.style.border = '0px';
  346. return a;
  347. };
  348. };
  349. const linkSmallImgs = function(ext) {
  350. return function() {
  351. const src = this.src;
  352. return linkImgs(src.substr(0, src.length - 7) + ext);
  353. };
  354. };
  355. const linkBigImgs = function() {
  356. const src = $(this).attr('big');
  357. return linkImgs(src);
  358. };
  359. $('img[big$=".jpg"]').wrap(linkBigImgs);
  360. $('img[src$="-sm.jpg"]').wrap(linkSmallImgs('.jpg'));
  361. $('img[src$="-sm.gif"]').wrap(linkSmallImgs('.gif'));
  362. $('img[src$="-sm.png"]').wrap(linkSmallImgs('.png'));
  363. $('pre>code')
  364. .unwrap()
  365. .replaceWith(function() {
  366. return $('<pre class="prettyprint showlinemods notranslate" translate="no">' + this.innerHTML + '</pre>');
  367. });
  368. if (window.prettyPrint) {
  369. window.prettyPrint();
  370. }
  371. $('span[class=com]')
  372. .addClass('translate yestranslate')
  373. .attr('translate', 'yes');
  374. const params = getQueryParams();
  375. if (params.doubleSpace || params.doublespace) {
  376. document.body.className = document.body.className + ' doubleSpace';
  377. }
  378. $('.language').on('change', function() {
  379. window.location.href = this.value;
  380. });
  381. if (window.threejsLessonUtils) {
  382. window.threejsLessonUtils.afterPrettify();
  383. }
  384. });
  385. }(jQuery));
  386. // ios needs this to allow touch events in an iframe
  387. window.addEventListener('touchstart', {});