This commit is contained in:
Josef 2025-06-24 13:24:33 +02:00
parent 8c8b50b6da
commit 26d24f9fe6
5 changed files with 51 additions and 18 deletions

View File

@ -70,28 +70,28 @@ namespace Rokojori
AddNode3DGizmoPlugin( gizmoDrawerPlugin ); AddNode3DGizmoPlugin( gizmoDrawerPlugin );
var pePackedScene = GD.Load<PackedScene>( ProblemsExplorerPath ); // var pePackedScene = GD.Load<PackedScene>( ProblemsExplorerPath );
if ( pePackedScene != null ) // if ( pePackedScene != null )
{ // {
// this.LogInfo( "Problems Explorer found: ", pePackedScene ); // // this.LogInfo( "Problems Explorer found: ", pePackedScene );
messages = ((PackedScene)pePackedScene).Instantiate<Control>(); // messages = ((PackedScene)pePackedScene).Instantiate<Control>();
var ui = messages.Get<UI>(); // var ui = messages.Get<UI>();
ui.BindOwnChildren(); // ui.BindOwnChildren();
var shortCut = new Shortcut(); // var shortCut = new Shortcut();
shortCut.Events = [ new InputEventKey{ CtrlPressed = true, Keycode = Key.U } ]; // shortCut.Events = [ new InputEventKey{ CtrlPressed = true, Keycode = Key.U } ];
AddControlToDock( DockSlot.RightBr, messages, shortCut ); // AddControlToDock( DockSlot.RightBr, messages, shortCut );
} // }
else // else
{ // {
this.LogInfo( "Problems Explorer not found: ", ProblemsExplorerPath ); // this.LogInfo( "Problems Explorer not found: ", ProblemsExplorerPath );
} // }
} }
public override void _ExitTree() public override void _ExitTree()

View File

@ -352,11 +352,22 @@ namespace Rokojori
return GetGlobalRotationFrom( node ); return GetGlobalRotationFrom( node );
} }
public static Quaternion GetGlobalRotationFrom( Node3D node ) public static Quaternion GetGlobalRotationFrom( Node3D node )
{ {
var quaternion = node.GlobalBasis.GetRotationQuaternion(); var quaternion = node.GlobalBasis.GetRotationQuaternion();
return quaternion; return quaternion;
}
public static float GlobalYawDegrees( this Node3D node3D )
{
return GlobalYawDegrees( node3D.GlobalForward() );
}
public static float GlobalYawRadians( this Node3D node3D )
{
return Mathf.DegToRad( GlobalYawDegrees( node3D ) );
} }
public static Vector3 GetMin<T>( List<T> data, Func<T,Vector3> getPosition ) public static Vector3 GetMin<T>( List<T> data, Func<T,Vector3> getPosition )
@ -632,7 +643,8 @@ namespace Rokojori
public static float GlobalYaw( Vector3 direction ) public static float GlobalYaw( Vector3 direction )
{ {
return ( Mathf.Pi * 2.0f - Mathf.Atan2( direction.Z, direction.X ) ) - Mathf.Pi / 2.0f; return Mathf.Atan2( direction.X, direction.Z );
// return ( Mathf.Pi * 2.0f - Mathf.Atan2( direction.Z, direction.X ) ) - Mathf.Pi / 2.0f;
} }
public static float GlobalYawDegrees( Vector3 direction ) public static float GlobalYawDegrees( Vector3 direction )

View File

@ -22,6 +22,12 @@ namespace Rokojori
[Export( PropertyHint.Range, "0,1") ] [Export( PropertyHint.Range, "0,1") ]
public float grayAmount = 0f; public float grayAmount = 0f;
[Export( PropertyHint.Range, "0,1") ]
public float mappedMinValue = 0f;
[Export( PropertyHint.Range, "0,1") ]
public float mappedMaxValue = 0f;
protected override void OnConfigure() protected override void OnConfigure()
{ {
EffectCallbackType = EffectCallbackTypeEnum.PostTransparent; EffectCallbackType = EffectCallbackTypeEnum.PostTransparent;
@ -41,7 +47,9 @@ namespace Rokojori
constants.Set( constants.Set(
depthAmount, depthAmount,
depthPower, depthPower,
grayAmount grayAmount,
mappedMinValue,
mappedMaxValue
); );
} }

View File

@ -15,6 +15,8 @@ uniform Parameters
float depthAmount; float depthAmount;
float depthPower; float depthPower;
float grayAmount; float grayAmount;
float mappedMinValue;
float mappedMaxValue;
} parameters; } parameters;
@ -39,6 +41,7 @@ void main()
vec4 color = imageLoad( colorImage, uv ); vec4 color = imageLoad( colorImage, uv );
float depth = sampleDepth( uv, size ); float depth = sampleDepth( uv, size );
depth = ( depth - parameters.mappedMinValue ) / ( parameters.mappedMaxValue - parameters.mappedMinValue );
float gray = color.r * 0.2 + color.g * 0.7 + color.b * 0.1; float gray = color.r * 0.2 + color.g * 0.7 + color.b * 0.1;
@ -46,7 +49,7 @@ void main()
depthValue = mix( depthValue, depthValue * gray, parameters.grayAmount ); depthValue = mix( depthValue, depthValue * gray, parameters.grayAmount );
color.rgb = vec3( depthValue, depthValue, depthValue ); color.rgb = mix( color.rgb, vec3( depthValue, depthValue, depthValue ), parameters.depthAmount );
imageStore( colorImage, uv, color ); imageStore( colorImage, uv, color );
} }

View File

@ -499,6 +499,11 @@ mat4 rotationZ_m4( float radiansAngle )
); );
} }
mat4 eulerRotation( vec3 eulerRadians )
{
return rotationX_m4( eulerRadians.x ) * rotationY_m4( eulerRadians.y ) * rotationZ_m4( eulerRadians.z );
}
mat3 quaternionToRotationMatrix( vec4 q ) mat3 quaternionToRotationMatrix( vec4 q )
{ {
float x = q.x; float x = q.x;
@ -553,6 +558,11 @@ mat4 TRS( vec3 translation, vec4 rotation, vec3 scale )
return translate_m4( translation ) * mat4( quaternionToRotationMatrix( rotation ) ) * scale_m4( scale ); return translate_m4( translation ) * mat4( quaternionToRotationMatrix( rotation ) ) * scale_m4( scale );
} }
mat4 TRS( vec3 translation, vec3 eulerRadians, vec3 scale )
{
return translate_m4( translation ) * eulerRotation( eulerRadians ) * scale_m4( scale );
}
mat4 mixTRS( mat4 a, mat4 b, float t ) mat4 mixTRS( mat4 a, mat4 b, float t )
{ {
vec3 oA = extractTranslation( a ); vec3 oA = extractTranslation( a );