@@ -41,7 +41,8 @@ import { RoomEnvironment, pxlEffects } from "pxlNav";
4141
4242import { rabbitDruidVert , rabbitDruidFrag ,
4343 envGroundVert , envGroundFrag ,
44- salioaPlantVert , salioaPlantFrag
44+ salioaPlantVert , salioaPlantFrag ,
45+ hoodooVert , hoodooFrag
4546 } from "./Shaders.js" ;
4647
4748const FloatingDust = pxlEffects . pxlParticles . FloatingDust ;
@@ -104,6 +105,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
104105 this . inspectDuration = 1.5 ;
105106 this . inspectInitialTransition = 0 ;
106107
108+ this . initialHoodooSet = false ;
107109
108110 this . touchMouseData = {
109111 'active' :false ,
@@ -131,11 +133,11 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
131133 ndcPosition : null
132134 } ,
133135 'leftHoodooPosition' : {
134- basePosition : new Vector3 ( - .9 , 0.5 , 200 ) ,
136+ basePosition : new Vector3 ( - .83 , 0.47 , 165 ) ,
135137 ndcPosition : null
136138 } ,
137139 'rightHoodooPosition' : {
138- basePosition : new Vector3 ( .9 , 0.5 , 200 ) ,
140+ basePosition : new Vector3 ( .73 , 0.47 , 165 ) ,
139141 ndcPosition : null
140142 } ,
141143 } ;
@@ -199,6 +201,15 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
199201 coreCanvas . addEventListener ( "mouseup" , ( e ) => { this . mapOnUp ( e ) ; } , false ) ;
200202
201203 setTimeout ( ( ) => { this . setCameraSpaceNDC ( ) ; } , 0 ) ;
204+
205+ if ( ! this . initialHoodooSet ) {
206+ setTimeout ( ( ) => {
207+ this . updateHoodooPositions ( ) ;
208+ this . geoList [ "Scripted" ] [ "Hoodoo_Left_geo" ] . updateMatrix ( ) ;
209+ this . geoList [ "Scripted" ] [ "Hoodoo_Right_geo" ] . updateMatrix ( ) ;
210+ } , 10 ) ;
211+ this . initialHoodooSet = true ;
212+ }
202213 }
203214
204215 stop ( ) {
@@ -304,6 +315,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
304315
305316 mapOnDown ( e ) {
306317 //let target= e.path ? e.path[0] : e.target; // Chrome or Firefox
318+ if ( ! this . inspectToMode ) return false ;
307319 if ( this . pxlTimer . active ) {
308320 this . touchMouseData . button = e . which ;
309321 this . touchMouseData . active = true ;
@@ -319,6 +331,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
319331 }
320332 }
321333 mapOnMove ( e ) {
334+ if ( ! this . inspectToMode ) return false ;
322335 if ( this . pxlTimer . active || this . pxlDevice . cursorLockActive ) {
323336 this . pxlDevice . getMouseXY ( e ) ;
324337 if ( ( this . touchMouseData . active || this . pxlDevice . cursorLockActive ) && this . touchMouseData . startPos ) {
@@ -332,6 +345,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
332345 }
333346 }
334347 mapOnUp ( e ) {
348+ if ( ! this . inspectToMode ) return false ;
335349
336350 this . touchMouseData . dragCount ++ ;
337351 this . touchMouseData . dragTotal += this . touchMouseData . dragCount ;
@@ -413,6 +427,21 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
413427 curMesh . morphTargetInfluences [ 0 ] = this . eyeBlinkInf . x ;
414428 }
415429
430+ // -- -- --
431+
432+ updateHoodooPositions ( ) {
433+ if ( this . geoList [ "Scripted" ] ?. hasOwnProperty ( "Hoodoo_Left_geo" ) && this . ndcPositions . leftHoodooPosition . ndcPosition ) {
434+ let locPos = this . ndcPositions . leftHoodooPosition . ndcPosition . clone ( ) ;
435+ this . geoList [ "Scripted" ] [ "Hoodoo_Left_geo" ] . position . copy ( locPos ) ;
436+ this . geoList [ "Scripted" ] [ "Hoodoo_Left_geo" ] . updateMatrix ( ) ;
437+ }
438+ if ( this . geoList [ "Scripted" ] ?. hasOwnProperty ( "Hoodoo_Right_geo" ) && this . ndcPositions . rightHoodooPosition . ndcPosition ) {
439+ let locPos = this . ndcPositions . rightHoodooPosition . ndcPosition . clone ( ) ;
440+ this . geoList [ "Scripted" ] [ "Hoodoo_Right_geo" ] . position . copy ( locPos ) ;
441+ this . geoList [ "Scripted" ] [ "Hoodoo_Right_geo" ] . updateMatrix ( ) ;
442+ }
443+ }
444+
416445 // -- -- --
417446
418447 prepInspectMode ( curMesh ) {
@@ -537,6 +566,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
537566 if ( this . inspectToMode && this . inspectController && this . ndcPositions . inspectorPosition . ndcPosition ) {
538567 setTimeout ( ( ) => {
539568 this . inspectController . position . copy ( this . ndcPositions . inspectorPosition . ndcPosition ) ;
569+ this . updateHoodooPositions ( ) ;
540570 } ) ;
541571 }
542572 super . resize ( sw , sh ) ;
@@ -617,6 +647,7 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
617647 }
618648 }
619649
650+
620651 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
621652
622653 // TODO : This needs to not be needed --
@@ -737,6 +768,40 @@ export class SaltFlatsEnvironment extends RoomEnvironment{
737768 envGroundUniforms . noiseTexture . value = this . pxlUtils . loadTexture ( "Noise_UniformWebbing.jpg" ) ;
738769 envGroundUniforms . smoothNoiseTexture . value = this . pxlUtils . loadTexture ( "Noise_Soft3d.jpg" , null , textureOptionsRepeat ) ;
739770
771+ // -- -- --
772+
773+ let hoodooLeftUniforms = UniformsUtils . merge (
774+ [
775+ UniformsLib [ "lights" ] ,
776+ {
777+ 'cloudTexture' : { type :'t' , value : this . cloud3dTexture } ,
778+ 'fogColor' : { type : "c" , value : this . fogColor } ,
779+ } ]
780+ )
781+ let hoodooLeftMtl = this . pxlFile . pxlShaderBuilder ( hoodooLeftUniforms , hoodooVert ( ) , hoodooFrag ( ) ) ;
782+ hoodooLeftMtl . lights = true ;
783+
784+ this . materialList [ "Hoodoo_Left_geo" ] = hoodooLeftMtl ;
785+
786+ // -- -- --
787+
788+ let hoodooRightUniforms = UniformsUtils . merge (
789+ [
790+ UniformsLib [ "lights" ] ,
791+ {
792+ 'cloudTexture' : { type :'t' , value : this . cloud3dTexture } ,
793+ 'fogColor' : { type : "c" , value : this . fogColor } ,
794+ } ]
795+ )
796+ let hoodooRightMtl = this . pxlFile . pxlShaderBuilder ( hoodooRightUniforms , hoodooVert ( ) , hoodooFrag ( ) ) ;
797+ hoodooRightMtl . lights = true ;
798+
799+ this . materialList [ "Hoodoo_Right_geo" ] = hoodooRightMtl ;
800+
801+
802+
803+
804+
740805 // No need for normal maps on mobile
741806 // Just wasted resources with little pay off
742807 let enableNormalMap = ! this . mobile ;
0 commit comments