@@ -28,7 +28,7 @@ export class CursorBlock {
2828 }
2929
3030 cursorLineMaterial : LineMaterial
31- interactionLines : null | { blockPos : Vec3 , mesh : THREE . Group } = null
31+ interactionLines : null | { blockPos : Vec3 , mesh : THREE . Group , shapePositions : BlocksShapes | undefined } = null
3232 prevColor : string | undefined
3333 blockBreakMesh : THREE . Mesh
3434 breakTextures : THREE . Texture [ ] = [ ]
@@ -62,13 +62,23 @@ export class CursorBlock {
6262 this . worldRenderer . onReactivePlayerStateUpdated ( 'gameMode' , ( ) => {
6363 this . updateLineMaterial ( )
6464 } )
65+ // todo figure out why otherwise fog from skybox breaks it
66+ setTimeout ( ( ) => {
67+ this . updateLineMaterial ( )
68+ if ( this . interactionLines ) {
69+ this . setHighlightCursorBlock ( this . interactionLines . blockPos , this . interactionLines . shapePositions , true )
70+ }
71+ } )
6572 }
6673
6774 // Update functions
6875 updateLineMaterial ( ) {
6976 const inCreative = this . worldRenderer . playerStateReactive . gameMode === 'creative'
7077 const pixelRatio = this . worldRenderer . renderer . getPixelRatio ( )
7178
79+ if ( this . cursorLineMaterial ) {
80+ this . cursorLineMaterial . dispose ( )
81+ }
7282 this . cursorLineMaterial = new LineMaterial ( {
7383 color : ( ( ) => {
7484 switch ( this . worldRenderer . worldRendererConfig . highlightBlockColor ) {
@@ -115,8 +125,8 @@ export class CursorBlock {
115125 }
116126 }
117127
118- setHighlightCursorBlock ( blockPos : Vec3 | null , shapePositions ?: BlocksShapes ) : void {
119- if ( blockPos && this . interactionLines && blockPos . equals ( this . interactionLines . blockPos ) ) {
128+ setHighlightCursorBlock ( blockPos : Vec3 | null , shapePositions ?: BlocksShapes , force = false ) : void {
129+ if ( blockPos && this . interactionLines && blockPos . equals ( this . interactionLines . blockPos ) && ! force ) {
120130 return
121131 }
122132 if ( this . interactionLines !== null ) {
@@ -140,7 +150,7 @@ export class CursorBlock {
140150 }
141151 this . worldRenderer . scene . add ( group )
142152 group . visible = ! this . cursorLinesHidden
143- this . interactionLines = { blockPos, mesh : group }
153+ this . interactionLines = { blockPos, mesh : group , shapePositions }
144154 }
145155
146156 render ( ) {
0 commit comments