lesson.js 21 KB

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