lesson.js 22 KB

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