@@ -4,7 +4,7 @@ import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js'
44import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry.js'
55import WebGL from 'three/examples/jsm/capabilities/WebGL.js'
66import { onBeforeUnmount , onMounted , ref } from 'vue'
7- import { useDefines } from './defines '
7+ import { useI18n } from 'vue-i18n '
88
99export const useWebGL = ( ) => {
1010 const isLoaded = ref ( false )
@@ -19,6 +19,8 @@ export const useWebGL = () => {
1919 const _cloudParticles : any = [ ]
2020 const meshArray : any = [ ]
2121
22+ const { t, getLocaleMessage, locale } = useI18n ( )
23+
2224 const init = ( ) => {
2325 onMounted ( ( ) => {
2426 if ( ! WebGL . isWebGLAvailable ( ) ) {
@@ -106,24 +108,28 @@ export const useWebGL = () => {
106108 }
107109
108110 const createNodes = ( ) => {
109- for ( let i = - 1000 ; i < 1000 ; i += 50 ) {
110- const paragraph = new TextGeometry ( useDefines ( ) . landing ( ) . name ( ) , {
111+ const { landing } : any = getLocaleMessage ( locale . value )
112+
113+ const paragraphs = landing . first . paragraphs
114+
115+ paragraphs . forEach ( ( paragraph ) => {
116+ const geometry = new TextGeometry ( paragraph , {
111117 font : _font ,
112118 size : Math . floor ( Math . random ( ) * 8 ) + 8 ,
113119 height : 1 ,
114120 } )
115121
116- const mesh = new THREE . Mesh ( paragraph )
117- mesh . position . x = Math . random ( ) * 2000 - 1000 + i
118- mesh . position . y = 650 - Math . random ( ) * 170
119- mesh . position . z = Math . random ( ) * 2000 - 1000 + i
122+ const mesh = new THREE . Mesh ( geometry )
123+ mesh . position . x = Math . random ( ) * 2500 - 1000
124+ mesh . position . y = 650 - Math . random ( ) * 10
125+ mesh . position . z = Math . random ( ) * 2500 - 1000
120126 mesh . rotation . x = 1.16
121127 mesh . rotation . y = - 0.12
122128 mesh . rotation . z = 0.57
123129
124130 meshArray . push ( mesh )
125131 scene . add ( mesh )
126- }
132+ } )
127133 }
128134
129135 const render = ( ) => {
@@ -165,10 +171,10 @@ export const useWebGL = () => {
165171 cameraCreate ( )
166172 rendererCreate ( )
167173 loaderSmoke ( )
174+ createNodes ( )
168175 contextResize ( )
169176 createLight ( )
170177 contextResize ( )
171- createNodes ( )
172178 render ( ) . then ( ( ) => {
173179 isLoaded . value = true
174180 } )
0 commit comments