shuvit 6 years ago
parent
commit
c65dd60cf8
2 changed files with 13 additions and 181 deletions
  1. 4
    6
      initer.py
  2. 9
    175
      joy_cam.py

+ 4
- 6
initer.py View File

10
     cont = bge.logic.getCurrentController()
10
     cont = bge.logic.getCurrentController()
11
     own = cont.owner
11
     own = cont.owner
12
     dict = bge.logic.globalDict
12
     dict = bge.logic.globalDict
13
+    
13
     own['lmLR'] = 0
14
     own['lmLR'] = 0
14
     own['lmUD'] = 0
15
     own['lmUD'] = 0
15
     own['rmLR'] = 0
16
     own['rmLR'] = 0
30
     own['bkBut'] = 0
31
     own['bkBut'] = 0
31
     own['ltsBut'] = 0
32
     own['ltsBut'] = 0
32
     own['rtsBut'] = 0
33
     own['rtsBut'] = 0
33
-    own['speed_mult'] = 1.00
34
     own['menu_on'] = False
34
     own['menu_on'] = False
35
     dict['menu_on'] = False
35
     dict['menu_on'] = False
36
     own['submenu_on'] = False
36
     own['submenu_on'] = False
54
     act = cont.actuators["dof_act"]
54
     act = cont.actuators["dof_act"]
55
     cont.activate(act)        
55
     cont.activate(act)        
56
     
56
     
57
-    
58
-    
59
     dict['menuText'] = ''
57
     dict['menuText'] = ''
60
     dict['submenuText'] = ''
58
     dict['submenuText'] = ''
61
     dict['optionText'] = ''
59
     dict['optionText'] = ''
62
-    
60
+
61
+#user setable defaults    
62
+    own['speed_mult'] = 1.00
63
     own['FXAA_SPAN_MAX'] = 16.0
63
     own['FXAA_SPAN_MAX'] = 16.0
64
     own['bc'] = True
64
     own['bc'] = True
65
     own['ao'] = True
65
     own['ao'] = True
67
     own['BC_BRIGHTNESS'] = 1.15
67
     own['BC_BRIGHTNESS'] = 1.15
68
     own['aowidth'] = 64
68
     own['aowidth'] = 64
69
     own['aoradius'] = 64
69
     own['aoradius'] = 64
70
-    
71
     own['hdr'] = True
70
     own['hdr'] = True
72
     own['HDRamount'] = .05
71
     own['HDRamount'] = .05
73
     own['avgL'] = 1.0
72
     own['avgL'] = 1.0
74
     
73
     
75
-    
76
 main()
74
 main()

+ 9
- 175
joy_cam.py View File

28
     dict['last_ltsBut'] = own['ltsBut']
28
     dict['last_ltsBut'] = own['ltsBut']
29
     dict['last_rtsBut'] = own['rtsBut']    
29
     dict['last_rtsBut'] = own['rtsBut']    
30
     
30
     
31
-
32
-#####
33
-    #hard controller mappings    
31
+#hard controller mappings    
34
     lar_lts = 0
32
     lar_lts = 0
35
     uad_lts = 1
33
     uad_lts = 1
36
     lar_rts = 2 
34
     lar_rts = 2 
56
     reduction = 400000
54
     reduction = 400000
57
     axisTh = 0.03    
55
     axisTh = 0.03    
58
 
56
 
59
-#####
60
-    #get value 0-100    
57
+#get controller axis value 0-100    
61
     lLR = aXis.axisValues[lar_lts] / reduction / .082 * 100
58
     lLR = aXis.axisValues[lar_lts] / reduction / .082 * 100
62
     lUD = aXis.axisValues[uad_lts] / reduction / .082 * 100 - 20 / 80
59
     lUD = aXis.axisValues[uad_lts] / reduction / .082 * 100 - 20 / 80
63
     rLR = aXis.axisValues[lar_rts] / reduction / .082 * 100 - 20 / 80
60
     rLR = aXis.axisValues[lar_rts] / reduction / .082 * 100 - 20 / 80
81
     udPad = bUtt.getButtonStatus(u_dp)
78
     udPad = bUtt.getButtonStatus(u_dp)
82
     ddPad = bUtt.getButtonStatus(d_dp)
79
     ddPad = bUtt.getButtonStatus(d_dp)
83
 
80
 
84
-#######
85
-    #get own['idle']
81
+#check if idle
86
     idle_trig_list = [lLR, lUD, rLR, rUD, lTrig, rTrig]
82
     idle_trig_list = [lLR, lUD, rLR, rUD, lTrig, rTrig]
87
     idle_time = 240
83
     idle_time = 240
88
     idle_set = 1
84
     idle_set = 1
102
     if own['idle_timer'] > 1:
98
     if own['idle_timer'] > 1:
103
         own['idle_timer'] -= 1
99
         own['idle_timer'] -= 1
104
          
100
          
105
-    #print(own['idle_timer'], own['idle'])
106
-####    
101
+#idle cam movement    
107
     if own['idle']:
102
     if own['idle']:
108
         move_len = 1080
103
         move_len = 1080
109
         if own['idlecampos_x'] < move_len:
104
         if own['idlecampos_x'] < move_len:
120
             move = [-.0002, 0, 0]
115
             move = [-.0002, 0, 0]
121
             own.applyMovement( move, True)
116
             own.applyMovement( move, True)
122
             own.applyRotation([-.00004, 0, -.00005],True)
117
             own.applyRotation([-.00004, 0, -.00005],True)
123
-            #print('idle2')     
124
-        #print(own['idlecampos_x'])                           
125
     
118
     
126
-
127
 #####
119
 #####
128
     #create modified axis values
120
     #create modified axis values
129
     if lLR < -20:
121
     if lLR < -20:
178
         rot_x = own['last_rot_x'] * damping
170
         rot_x = own['last_rot_x'] * damping
179
     if rot_y == 0 and own['last_rot_y'] != 0:
171
     if rot_y == 0 and own['last_rot_y'] != 0:
180
         rot_y = own['last_rot_y'] * damping         
172
         rot_y = own['last_rot_y'] * damping         
181
-                         
182
-    
173
+                             
183
     move = [move_y, 0, move_x]
174
     move = [move_y, 0, move_x]
184
     own.applyMovement( move, True)
175
     own.applyMovement( move, True)
185
     own.applyMovement([0, 0, move_z], False)    
176
     own.applyMovement([0, 0, move_z], False)    
193
     if rBump == True and own['rBump'] == False:
184
     if rBump == True and own['rBump'] == False:
194
         if own['speed_mult'] < 5.5:
185
         if own['speed_mult'] < 5.5:
195
             own['speed_mult'] = round(own['speed_mult'] + mult, 2)            
186
             own['speed_mult'] = round(own['speed_mult'] + mult, 2)            
196
-
197
     if stBut == True and own['stBut'] != True:
187
     if stBut == True and own['stBut'] != True:
198
         if own['menu_on'] == False:
188
         if own['menu_on'] == False:
199
             own['menu_on'] = True
189
             own['menu_on'] = True
200
-
201
         else:    
190
         else:    
202
             own['menu_on'] = False            
191
             own['menu_on'] = False            
203
-    #if own['menu_on'] == True:
204
-        #empty = scene.objects["menuEmpty"]
205
-        #bg = scene.objects['menu_background']
206
-        #h1 = scene.objects['h1Text']
207
-        #bg.worldPosition = empty.worldPosition
208
-        #bg.orientation = empty.orientation
209
-        #h1.worldPosition = empty.worldPosition
210
-        #h1.orientation = empty.orientation   
211
-        #h1 = scene.objects['h1Text']
212
-        #h1.text = str("user@shuvit.org~:\\") 
213
-        
214
-        
215
     menu_item = own['menu_item']    
192
     menu_item = own['menu_item']    
216
-    #menu_list = ['Brightness/Contrast: ', 'Brightness Value: ', 'Contrast Value: ', 'FXAA: ', 'FXAA Span Max: ', 'SSAO: ', 'SSAO Only: ', 'SSAO Width: ', 'SSAO Radius: ', 'HDR: ', 'HDR Amount: ', 'HDR AvgL: ', 'Camera Focal Length: ',  'Restart  ', 'Exit  ']
217
     menu_list = ['Brightness/Contrast: ', 'FXAA: ', 'SSAO: ', 'HDR: ', 'Camera: ',  'Restart: ', 'Exit: ']
193
     menu_list = ['Brightness/Contrast: ', 'FXAA: ', 'SSAO: ', 'HDR: ', 'Camera: ',  'Restart: ', 'Exit: ']
218
     
194
     
219
     brightnesscontrast_opt = ['On/Off: ', 'Brightness Value: ', 'Contrast Value: ', 'Back: ']
195
     brightnesscontrast_opt = ['On/Off: ', 'Brightness Value: ', 'Contrast Value: ', 'Back: ']
222
     hdr_opt = ['On/Off: ', 'HDR Amount: ', 'HDR AvgL: ', 'Back: ']
198
     hdr_opt = ['On/Off: ', 'HDR Amount: ', 'HDR AvgL: ', 'Back: ']
223
     camera_opt = ['Focal Length: ', 'Back: ']
199
     camera_opt = ['Focal Length: ', 'Back: ']
224
 ################    
200
 ################    
225
-    
226
     submenu_on = own['submenu_on']
201
     submenu_on = own['submenu_on']
227
     if aBut == False and own['aBut'] == True:
202
     if aBut == False and own['aBut'] == True:
228
         if submenu_on:
203
         if submenu_on:
239
     menu_item = own['menu_item']
214
     menu_item = own['menu_item']
240
     submenu_item = own['submenu_item']
215
     submenu_item = own['submenu_item']
241
     dict['menuText'] = menu_list[menu_item] 
216
     dict['menuText'] = menu_list[menu_item] 
242
-    #dict['submenuText'] = menu_list[submenu_item] 
243
-    
244
     if menu_list[menu_item] == 'Brightness/Contrast: ':
217
     if menu_list[menu_item] == 'Brightness/Contrast: ':
245
         if submenu_on == True:
218
         if submenu_on == True:
246
             try:
219
             try:
262
                 dict['optionText'] = '_'       
235
                 dict['optionText'] = '_'       
263
         else:
236
         else:
264
             dict['optionText'] = ''                             
237
             dict['optionText'] = ''                             
265
-
266
     if menu_list[menu_item] == 'FXAA: ':
238
     if menu_list[menu_item] == 'FXAA: ':
267
         if submenu_on == True:
239
         if submenu_on == True:
268
             try:
240
             try:
282
                 dict['optionText'] = '_'       
254
                 dict['optionText'] = '_'       
283
         else:
255
         else:
284
             dict['optionText'] = ''
256
             dict['optionText'] = ''
285
-
286
-
287
-
288
-    #     if own['fxaa'] == False:
289
-    #         dict['optionText'] = 'Off'
290
-    #     if own['fxaa'] == True:
291
-    #         dict['optionText'] = 'On' 
292
-    # if menu_list[menu_item] == 'FXAA Span Max: ':
293
-    #     dict['optionText'] = round(own['FXAA_SPAN_MAX'], 2)
294
-
295
     if menu_list[menu_item] == 'HDR: ':
257
     if menu_list[menu_item] == 'HDR: ':
296
-
297
-
298
         if submenu_on == True:
258
         if submenu_on == True:
299
             try:
259
             try:
300
                 dict['submenuText'] = hdr_opt[submenu_item]
260
                 dict['submenuText'] = hdr_opt[submenu_item]
315
                 dict['optionText'] = '_'       
275
                 dict['optionText'] = '_'       
316
         else:
276
         else:
317
             dict['optionText'] = '' 
277
             dict['optionText'] = '' 
318
-
319
-
320
-        # if own['hdr'] == False:
321
-        #     dict['optionText'] = 'Off'
322
-        # if own['hdr'] == True:
323
-        #     dict['optionText'] = 'On' 
324
-
325
-    # if menu_list[menu_item] == 'HDR Amount: ':
326
-    #     dict['optionText'] = round(own['HDRamount'], 2)
327
-    # if menu_list[menu_item] == 'HDR AvgL: ':
328
-    #     dict['optionText'] = round(own['avgL'], 2)                 
329
-                        
330
- 
331
     if menu_list[menu_item] == 'SSAO: ':
278
     if menu_list[menu_item] == 'SSAO: ':
332
         if submenu_on == True:
279
         if submenu_on == True:
333
             try:
280
             try:
346
                     dict['optionText'] = 'Off'
293
                     dict['optionText'] = 'Off'
347
                 if own['onlyAO'] == True:
294
                 if own['onlyAO'] == True:
348
                     dict['optionText'] = 'On'                    
295
                     dict['optionText'] = 'On'                    
349
-            
350
             if ssao_opt[submenu_item] == 'SSAO Width: ': 
296
             if ssao_opt[submenu_item] == 'SSAO Width: ': 
351
                 dict['optionText'] = round(own['aowidth'], 2)
297
                 dict['optionText'] = round(own['aowidth'], 2)
352
             if ssao_opt[submenu_item] == 'SSAO Radius: ': 
298
             if ssao_opt[submenu_item] == 'SSAO Radius: ': 
355
                 dict['optionText'] = '_'       
301
                 dict['optionText'] = '_'       
356
         else:
302
         else:
357
             dict['optionText'] = ''
303
             dict['optionText'] = ''
358
-
359
-
360
-    #     if own['ao'] == False:
361
-    #         dict['optionText'] = 'Off'
362
-    #     if own['ao'] == True:
363
-    #         dict['optionText'] = 'On' 
364
-    # if menu_list[menu_item] == 'SSAO Only: ':
365
-    #     print('ssao menu', own['onlyAO'])
366
-    #     if own['onlyAO'] == False:
367
-    #         dict['optionText'] = 'Off'
368
-    #     if own['onlyAO'] == True:
369
-    #         dict['optionText'] = 'On'
370
-    # if menu_list[menu_item] == 'SSAO Width: ': 
371
-    #     dict['optionText'] = round(own['aowidth'], 2) 
372
-    # if menu_list[menu_item] == 'SSAO Radius: ': 
373
-    #     dict['optionText'] = round(own['aoradius'], 2)                           
374
-
375
     if menu_list[menu_item] == 'Camera: ':
304
     if menu_list[menu_item] == 'Camera: ':
376
-
377
-
378
         if submenu_on == True:
305
         if submenu_on == True:
379
             try:
306
             try:
380
                 dict['submenuText'] = camera_opt[submenu_item]
307
                 dict['submenuText'] = camera_opt[submenu_item]
388
                 dict['optionText'] = '_'                      
315
                 dict['optionText'] = '_'                      
389
         else:
316
         else:
390
             dict['optionText'] = ''  
317
             dict['optionText'] = ''  
391
-
392
-
393
-        
394
-        
395
     if menu_list[menu_item] == 'Restart: ':
318
     if menu_list[menu_item] == 'Restart: ':
396
         dict['optionText'] = ''
319
         dict['optionText'] = ''
397
     if menu_list[menu_item] == 'Exit: ': 
320
     if menu_list[menu_item] == 'Exit: ': 
398
         dict['optionText'] = ''                               
321
         dict['optionText'] = ''                               
399
             
322
             
400
-           
401
-                               
323
+#b button pressed
402
     if bBut == False and own['bBut'] == True:
324
     if bBut == False and own['bBut'] == True:
403
         if menu_list[menu_item] == 'Brightness/Contrast: ':
325
         if menu_list[menu_item] == 'Brightness/Contrast: ':
404
             if submenu_on == False:
326
             if submenu_on == False:
419
                     own['submenu_on'] = False 
341
                     own['submenu_on'] = False 
420
                     dict['optionText'] = '_'  
342
                     dict['optionText'] = '_'  
421
                     own['submenu_item'] = 0                  
343
                     own['submenu_item'] = 0                  
422
-
423
-                          
424
         if menu_list[menu_item] == 'FXAA: ':
344
         if menu_list[menu_item] == 'FXAA: ':
425
             if submenu_on == False:
345
             if submenu_on == False:
426
                 submenu_on = True
346
                 submenu_on = True
427
                 own['submenu_on'] = True
347
                 own['submenu_on'] = True
428
-
429
             elif submenu_on:
348
             elif submenu_on:
430
                 if fxaa_opt[submenu_item] == 'On/Off: ':
349
                 if fxaa_opt[submenu_item] == 'On/Off: ':
431
                     if own['bc'] == False:
350
                     if own['bc'] == False:
439
                     own['submenu_on'] = False 
358
                     own['submenu_on'] = False 
440
                     dict['optionText'] = '_'  
359
                     dict['optionText'] = '_'  
441
                     own['submenu_item'] = 0 
360
                     own['submenu_item'] = 0 
442
-
443
-
444
-
445
- 
446
         if menu_list[menu_item] == 'SSAO: ':
361
         if menu_list[menu_item] == 'SSAO: ':
447
-
448
-
449
             if submenu_on == False:
362
             if submenu_on == False:
450
                 submenu_on = True
363
                 submenu_on = True
451
                 own['submenu_on'] = True
364
                 own['submenu_on'] = True
467
                     own['submenu_on'] = False 
380
                     own['submenu_on'] = False 
468
                     dict['optionText'] = '_'  
381
                     dict['optionText'] = '_'  
469
                     own['submenu_item'] = 0
382
                     own['submenu_item'] = 0
470
-                              
471
-                                
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
         if menu_list[menu_item] == 'HDR: ':
383
         if menu_list[menu_item] == 'HDR: ':
480
-
481
-
482
             if submenu_on == False:
384
             if submenu_on == False:
483
                 submenu_on = True
385
                 submenu_on = True
484
                 own['submenu_on'] = True
386
                 own['submenu_on'] = True
497
                     own['submenu_on'] = False 
399
                     own['submenu_on'] = False 
498
                     dict['optionText'] = '_'  
400
                     dict['optionText'] = '_'  
499
                     own['submenu_item'] = 0 
401
                     own['submenu_item'] = 0 
500
-
501
-
502
-            
503
         if menu_list[menu_item] == 'Camera: ':
402
         if menu_list[menu_item] == 'Camera: ':
504
             if submenu_on == False:
403
             if submenu_on == False:
505
                 submenu_on = True
404
                 submenu_on = True
511
                 if camera_opt[submenu_item] == 'Back: ': 
410
                 if camera_opt[submenu_item] == 'Back: ': 
512
                     own['submenu_on'] = False 
411
                     own['submenu_on'] = False 
513
                     dict['optionText'] = '_'  
412
                     dict['optionText'] = '_'  
514
-                    own['submenu_item'] = 0                     
515
-
516
-                       
413
+                    own['submenu_item'] = 0                                
517
         if menu_list[menu_item] == 'Restart: ':
414
         if menu_list[menu_item] == 'Restart: ':
518
             scene.restart()
415
             scene.restart()
519
         if menu_list[menu_item] == 'Exit: ': 
416
         if menu_list[menu_item] == 'Exit: ': 
520
             bge.logic.endGame() 
417
             bge.logic.endGame() 
521
                          
418
                          
522
-
523
-#333333333333333333333333333333
524
-                            
419
+#x button up               
525
     if xBut == False and own['xBut'] == True:
420
     if xBut == False and own['xBut'] == True:
526
-
527
-
528
-
529
-
530
         if menu_list[menu_item] == 'Brightness/Contrast: ':
421
         if menu_list[menu_item] == 'Brightness/Contrast: ':
531
             if submenu_on == False:
422
             if submenu_on == False:
532
                 submenu_on = True
423
                 submenu_on = True
546
                     own['submenu_on'] = False 
437
                     own['submenu_on'] = False 
547
                     dict['optionText'] = '_' 
438
                     dict['optionText'] = '_' 
548
                     own['submenu_item'] = 0
439
                     own['submenu_item'] = 0
549
-
550
-
551
-
552
-
553
-
554
-
555
-#         
556
-#        if menu_list[menu_item] == 'Brightness/Contrast: ':
557
-#            if own['bc'] == True:
558
-#                own['bc'] = False
559
-#                act = cont.actuators['bc_off']
560
-#                cont.activate(act)
561
-#                dict['optionText'] = 'Off'
562
-#        if menu_list[menu_item] == 'Brightness Value: ':
563
-#            own['BC_BRIGHTNESS'] -= .025
564
-#        if menu_list[menu_item] == 'Contrast Value: ':
565
-#            own['BC_CONTRAST'] -= .025            
566
-                                    
567
         if menu_list[menu_item] == 'FXAA: ':     
440
         if menu_list[menu_item] == 'FXAA: ':     
568
-        
569
             if submenu_on == False:
441
             if submenu_on == False:
570
                 submenu_on = True
442
                 submenu_on = True
571
                 own['submenu_on'] = True
443
                 own['submenu_on'] = True
582
                     own['submenu_on'] = False 
454
                     own['submenu_on'] = False 
583
                     dict['optionText'] = '_' 
455
                     dict['optionText'] = '_' 
584
                     own['submenu_item'] = 0
456
                     own['submenu_item'] = 0
585
-
586
-
587
-
588
-
589
-
590
-
591
         if menu_list[menu_item] == 'SSAO: ' : 
457
         if menu_list[menu_item] == 'SSAO: ' : 
592
-
593
-
594
-
595
             if submenu_on == False:
458
             if submenu_on == False:
596
                 submenu_on = True
459
                 submenu_on = True
597
                 own['submenu_on'] = True
460
                 own['submenu_on'] = True
604
                         dict['optionText'] = 'Off'                    
467
                         dict['optionText'] = 'Off'                    
605
                 if ssao_opt[submenu_item] == 'SSAO Only: ':
468
                 if ssao_opt[submenu_item] == 'SSAO Only: ':
606
                     if own['onlyAO'] == True:
469
                     if own['onlyAO'] == True:
607
-                        own['onlyAO'] = False                    
608
-                    
470
+                        own['onlyAO'] = False                                        
609
                 if ssao_opt[submenu_item] == 'SSAO Width: ': 
471
                 if ssao_opt[submenu_item] == 'SSAO Width: ': 
610
                     own['aowidth'] -= 1
472
                     own['aowidth'] -= 1
611
                 if ssao_opt[submenu_item] == 'SSAO Radius: ': 
473
                 if ssao_opt[submenu_item] == 'SSAO Radius: ': 
614
                     own['submenu_on'] = False 
476
                     own['submenu_on'] = False 
615
                     dict['optionText'] = '_' 
477
                     dict['optionText'] = '_' 
616
                     own['submenu_item'] = 0
478
                     own['submenu_item'] = 0
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
-
627
-
628
-
629
-
630
         if menu_list[menu_item] == 'HDR: ': 
479
         if menu_list[menu_item] == 'HDR: ': 
631
-            
632
-
633
-
634
             if submenu_on == False:
480
             if submenu_on == False:
635
                 submenu_on = True
481
                 submenu_on = True
636
                 own['submenu_on'] = True
482
                 own['submenu_on'] = True
649
                     own['submenu_on'] = False 
495
                     own['submenu_on'] = False 
650
                     dict['optionText'] = '_' 
496
                     dict['optionText'] = '_' 
651
                     own['submenu_item'] = 0
497
                     own['submenu_item'] = 0
652
-
653
-
654
-            
655
-
656
         if menu_list[menu_item] == 'Camera: ':
498
         if menu_list[menu_item] == 'Camera: ':
657
             if submenu_on == False:
499
             if submenu_on == False:
658
                 submenu_on = True
500
                 submenu_on = True
703
     dict['menu_item'] = own['menu_item']
545
     dict['menu_item'] = own['menu_item']
704
     dict['submenu_item'] = own['submenu_item']
546
     dict['submenu_item'] = own['submenu_item']
705
     dict['fxaa'] = own['fxaa']
547
     dict['fxaa'] = own['fxaa']
706
-    
707
-    
708
-    
709
-        
710
-    
711
-    print(own['submenu_on'])
712
-    #print(own['menu_item'])
713
-    #print(rot_x)
714
 
548
 
715
 main()
549
 main()
716
 
550
 

Loading…
Cancel
Save