wco_models 3.1.0.325 → 3.4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/production_theme.scss +4 -1
- data/app/assets/stylesheets/wco/main.scss +4 -0
- data/app/assets/stylesheets/wco/studio.scss +12 -4
- data/app/controllers/wco/api/newspartials_controller.rb +1 -1
- data/app/controllers/wco/api/newsproducer_controller.rb +5 -0
- data/app/controllers/wco/newspartials_controller.rb +1 -0
- data/app/models/iro/datapoint.rb +1 -1
- data/app/models/iro/option.rb +16 -2
- data/app/models/iro/position.rb +4 -6
- data/app/models/iro/priceitem.rb +42 -4
- data/app/models/iro/purse.rb +2 -0
- data/app/models/iro/stock.rb +1 -2
- data/app/models/tda/option.rb +4 -9
- data/app/models/wco/newspartial.rb +12 -4
- data/app/views/wco/api/newsproducer/README_newsproducer.txt +12 -0
- data/app/views/wco/api/newsproducer/_scenes.js-bk +20 -0
- data/app/views/wco/api/newsproducer/_scenes.js.erb +15 -0
- data/app/views/wco/api/newsproducer/{_studio_blue.js → _studio_blue1.js} +4 -1
- data/app/views/wco/api/newsproducer/_studio_blue2.js +912 -0
- data/app/views/wco/api/newsproducer/_studio_coc.js +769 -0
- data/app/views/wco/api/newsproducer/_studio_coc.js-bk +389 -0
- data/app/views/wco/api/newsproducer/_studio_coc.js-cannon +677 -0
- data/app/views/wco/api/newsproducer/_studio_fps.js +1018 -0
- data/app/views/wco/api/newsproducer/_studio_ra2.js +255 -0
- data/app/views/wco/api/newsproducer/_touch_controls.js +708 -0
- data/app/views/wco/api/newsproducer/_touch_pad.css +200 -0
- data/app/views/wco/api/newsproducer/games_fps.html +504 -0
- data/app/views/wco/api/newsproducer/{studio_green.html.erb → studio_blue0.html.erb} +1 -1
- data/app/views/wco/api/newsproducer/{studio_blue.html.erb → studio_blue1.html.erb} +3 -3
- data/app/views/wco/api/newsproducer/studio_blue2.html.erb +146 -0
- data/app/views/wco/api/newsproducer/studio_coc.html.erb +95 -0
- data/app/views/wco/api/newsproducer/studio_fps.html.erb +199 -0
- data/app/views/wco/api/newsproducer/studio_ra2.html.erb +95 -0
- data/app/views/wco/newspartials/_show_in_newsvideo.haml +6 -7
- data/app/views/wco/newspartials/index.haml-trash +6 -0
- data/config/initializers/08_integrations.rb +14 -1
- data/config/initializers/08_integrations.rb-example +0 -2
- data/config/routes.rb +3 -0
- data/lib/shortcuts.rb +1 -1
- metadata +23 -7
- data/app/views/wco/api/newsproducer/README.txt +0 -2
- /data/app/views/wco/api/newsproducer/{_studio_green.js → _studio_blue0.js} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
|
|
2
|
+
import * as THREE from 'three'
|
|
3
|
+
|
|
4
|
+
import Stats from 'three/addons/libs/stats.module.js'
|
|
5
|
+
|
|
6
|
+
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
|
|
7
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'
|
|
8
|
+
|
|
9
|
+
const scene = new THREE.Scene()
|
|
10
|
+
scene.background = new THREE.Color( 0x88ccee )
|
|
11
|
+
scene.fog = new THREE.Fog( 0x88ccee, 0, 50 )
|
|
12
|
+
|
|
13
|
+
const frustumSize = 10
|
|
14
|
+
const camera = new THREE.OrthographicCamera(
|
|
15
|
+
frustumSize * window.innerWidth / window.innerHeight / - 2,
|
|
16
|
+
frustumSize * window.innerWidth / window.innerHeight / 2,
|
|
17
|
+
frustumSize / 2,
|
|
18
|
+
frustumSize / - 2,
|
|
19
|
+
-100,
|
|
20
|
+
1000
|
|
21
|
+
)
|
|
22
|
+
camera.position.set( 0, 6, 8 )
|
|
23
|
+
camera.lookAt( 0, 0, 0 )
|
|
24
|
+
|
|
25
|
+
const fillLight1 = new THREE.HemisphereLight( 0x8dc1de, 0x00668d, 1.5 )
|
|
26
|
+
fillLight1.position.set( 2, 1, 1 )
|
|
27
|
+
scene.add( fillLight1 )
|
|
28
|
+
|
|
29
|
+
const directionalLight = new THREE.DirectionalLight( 0xffffff, 2.5 )
|
|
30
|
+
directionalLight.position.set( - 5, 25, - 1 )
|
|
31
|
+
directionalLight.castShadow = true
|
|
32
|
+
directionalLight.shadow.camera.near = 0.01
|
|
33
|
+
directionalLight.shadow.camera.far = 500
|
|
34
|
+
directionalLight.shadow.camera.right = 30
|
|
35
|
+
directionalLight.shadow.camera.left = - 30
|
|
36
|
+
directionalLight.shadow.camera.top = 30
|
|
37
|
+
directionalLight.shadow.camera.bottom = - 30
|
|
38
|
+
directionalLight.shadow.mapSize.width = 1024
|
|
39
|
+
directionalLight.shadow.mapSize.height = 1024
|
|
40
|
+
directionalLight.shadow.radius = 4
|
|
41
|
+
directionalLight.shadow.bias = - 0.00006
|
|
42
|
+
scene.add( directionalLight )
|
|
43
|
+
|
|
44
|
+
const container = document.getElementById( 'rotatingC' )
|
|
45
|
+
|
|
46
|
+
const renderer = new THREE.WebGLRenderer( { antialias: true } )
|
|
47
|
+
renderer.setPixelRatio( window.devicePixelRatio )
|
|
48
|
+
renderer.setSize( window.innerWidth, window.innerHeight )
|
|
49
|
+
renderer.setAnimationLoop( animate )
|
|
50
|
+
renderer.shadowMap.enabled = true
|
|
51
|
+
renderer.shadowMap.type = THREE.VSMShadowMap
|
|
52
|
+
renderer.toneMapping = THREE.ACESFilmicToneMapping
|
|
53
|
+
container.appendChild( renderer.domElement )
|
|
54
|
+
|
|
55
|
+
const controls = new OrbitControls( camera, renderer.domElement )
|
|
56
|
+
controls.enableDamping = true
|
|
57
|
+
controls.target.set( 0, 0, 0 )
|
|
58
|
+
controls.update()
|
|
59
|
+
|
|
60
|
+
const stats = new Stats()
|
|
61
|
+
stats.domElement.style.position = 'absolute'
|
|
62
|
+
stats.domElement.style.top = '0px'
|
|
63
|
+
container.appendChild( stats.domElement )
|
|
64
|
+
|
|
65
|
+
window.addEventListener( 'resize', onWindowResize )
|
|
66
|
+
|
|
67
|
+
function onWindowResize() {
|
|
68
|
+
|
|
69
|
+
const aspect = window.innerWidth / window.innerHeight
|
|
70
|
+
camera.left = frustumSize * aspect / - 2
|
|
71
|
+
camera.right = frustumSize * aspect / 2
|
|
72
|
+
camera.top = frustumSize / 2
|
|
73
|
+
camera.bottom = frustumSize / - 2
|
|
74
|
+
camera.updateProjectionMatrix()
|
|
75
|
+
|
|
76
|
+
renderer.setSize( window.innerWidth, window.innerHeight )
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const loader = new GLTFLoader()
|
|
81
|
+
const scene_url = 'https://cdn.jsdelivr.net/gh/wasya-co/ishlib3js@0.3.0/public/vendor/models/scenes/000mb%20collision-world/collision-world.glb'
|
|
82
|
+
const object_url = 'https://cdn.jsdelivr.net/gh/wasya-co/ishlib3js@0.3.0/public/vendor/models/City_Pack/Big%20Building.glb'
|
|
83
|
+
|
|
84
|
+
function enableShadows( model ) {
|
|
85
|
+
|
|
86
|
+
model.traverse( child => {
|
|
87
|
+
|
|
88
|
+
if ( child.isMesh ) {
|
|
89
|
+
|
|
90
|
+
child.castShadow = true
|
|
91
|
+
child.receiveShadow = true
|
|
92
|
+
|
|
93
|
+
if ( child.material && child.material.map ) {
|
|
94
|
+
|
|
95
|
+
child.material.map.anisotropy = 4
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
} )
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function placeOnPoint( model, point ) {
|
|
106
|
+
|
|
107
|
+
model.position.copy( point )
|
|
108
|
+
model.updateMatrixWorld( true )
|
|
109
|
+
const box = new THREE.Box3().setFromObject( model )
|
|
110
|
+
model.position.y += point.y - box.min.y
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function makeGhost( model ) {
|
|
115
|
+
|
|
116
|
+
const ghost = model.clone( true )
|
|
117
|
+
ghost.traverse( child => {
|
|
118
|
+
|
|
119
|
+
if ( ! child.isMesh ) return
|
|
120
|
+
|
|
121
|
+
const source = Array.isArray( child.material ) ? child.material : [ child.material ]
|
|
122
|
+
const ghost_mats = source.map( mat => {
|
|
123
|
+
|
|
124
|
+
const copy = mat.clone()
|
|
125
|
+
copy.transparent = true
|
|
126
|
+
copy.opacity = 0.4
|
|
127
|
+
copy.depthWrite = false
|
|
128
|
+
copy.needsUpdate = true
|
|
129
|
+
return copy
|
|
130
|
+
|
|
131
|
+
} )
|
|
132
|
+
child.material = Array.isArray( child.material ) ? ghost_mats : ghost_mats[ 0 ]
|
|
133
|
+
child.castShadow = false
|
|
134
|
+
child.receiveShadow = false
|
|
135
|
+
child.raycast = function () {}
|
|
136
|
+
|
|
137
|
+
} )
|
|
138
|
+
ghost.rotation.y = Math.PI / 4
|
|
139
|
+
return ghost
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const raycaster = new THREE.Raycaster()
|
|
144
|
+
const pointer = new THREE.Vector2()
|
|
145
|
+
const groundPlane = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), 0 )
|
|
146
|
+
const hitPoint = new THREE.Vector3()
|
|
147
|
+
|
|
148
|
+
let worldRoot = null
|
|
149
|
+
let objectTemplate = null
|
|
150
|
+
let objectGhost = null
|
|
151
|
+
let pointerDown = null
|
|
152
|
+
|
|
153
|
+
function getPointerHit( event ) {
|
|
154
|
+
|
|
155
|
+
const rect = renderer.domElement.getBoundingClientRect()
|
|
156
|
+
pointer.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1
|
|
157
|
+
pointer.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1
|
|
158
|
+
raycaster.setFromCamera( pointer, camera )
|
|
159
|
+
|
|
160
|
+
const targets = []
|
|
161
|
+
if ( worldRoot ) targets.push( worldRoot )
|
|
162
|
+
const hits = targets.length ? raycaster.intersectObjects( targets, true ) : []
|
|
163
|
+
if ( hits.length ) return hits[ 0 ].point
|
|
164
|
+
|
|
165
|
+
if ( raycaster.ray.intersectPlane( groundPlane, hitPoint ) ) return hitPoint
|
|
166
|
+
return null
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function moveGhost( event ) {
|
|
171
|
+
|
|
172
|
+
if ( ! objectGhost ) return
|
|
173
|
+
|
|
174
|
+
const point = getPointerHit( event )
|
|
175
|
+
if ( ! point ) {
|
|
176
|
+
|
|
177
|
+
objectGhost.visible = false
|
|
178
|
+
return
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
objectGhost.visible = true
|
|
183
|
+
placeOnPoint( objectGhost, point )
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function placeObject( event ) {
|
|
188
|
+
|
|
189
|
+
if ( ! objectTemplate ) return
|
|
190
|
+
|
|
191
|
+
const point = getPointerHit( event )
|
|
192
|
+
if ( ! point ) return
|
|
193
|
+
|
|
194
|
+
const placed = objectTemplate.clone( true )
|
|
195
|
+
enableShadows( placed )
|
|
196
|
+
placed.rotation.y = Math.PI / 4
|
|
197
|
+
placeOnPoint( placed, point )
|
|
198
|
+
scene.add( placed )
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
loader.load( scene_url, ( gltf ) => {
|
|
203
|
+
|
|
204
|
+
worldRoot = gltf.scene
|
|
205
|
+
scene.add( worldRoot )
|
|
206
|
+
worldRoot.rotation.y = Math.PI / 4
|
|
207
|
+
enableShadows( worldRoot )
|
|
208
|
+
|
|
209
|
+
worldRoot.updateMatrixWorld( true )
|
|
210
|
+
const box = new THREE.Box3().setFromObject( worldRoot )
|
|
211
|
+
const center = box.getCenter( new THREE.Vector3() )
|
|
212
|
+
camera.position.set( center.x, center.y + 6, center.z + 8 )
|
|
213
|
+
camera.lookAt( center )
|
|
214
|
+
controls.target.copy( center )
|
|
215
|
+
controls.update()
|
|
216
|
+
|
|
217
|
+
} )
|
|
218
|
+
|
|
219
|
+
loader.load( object_url, ( gltf ) => {
|
|
220
|
+
|
|
221
|
+
objectTemplate = gltf.scene
|
|
222
|
+
objectGhost = makeGhost( objectTemplate )
|
|
223
|
+
objectGhost.visible = false
|
|
224
|
+
scene.add( objectGhost )
|
|
225
|
+
|
|
226
|
+
} )
|
|
227
|
+
|
|
228
|
+
renderer.domElement.addEventListener( 'pointermove', moveGhost )
|
|
229
|
+
|
|
230
|
+
renderer.domElement.addEventListener( 'pointerdown', event => {
|
|
231
|
+
|
|
232
|
+
pointerDown = { x: event.clientX, y: event.clientY }
|
|
233
|
+
|
|
234
|
+
} )
|
|
235
|
+
|
|
236
|
+
renderer.domElement.addEventListener( 'pointerup', event => {
|
|
237
|
+
|
|
238
|
+
if ( ! pointerDown ) return
|
|
239
|
+
|
|
240
|
+
const dx = event.clientX - pointerDown.x
|
|
241
|
+
const dy = event.clientY - pointerDown.y
|
|
242
|
+
pointerDown = null
|
|
243
|
+
if ( dx * dx + dy * dy > 25 ) return
|
|
244
|
+
|
|
245
|
+
placeObject( event )
|
|
246
|
+
|
|
247
|
+
} )
|
|
248
|
+
|
|
249
|
+
function animate() {
|
|
250
|
+
|
|
251
|
+
controls.update()
|
|
252
|
+
renderer.render( scene, camera )
|
|
253
|
+
stats.update()
|
|
254
|
+
|
|
255
|
+
}
|