Skip to content

Upgrade project to .NET 10 and modernize CI#5

Open
gluschenko wants to merge 4 commits into
masterfrom
dotnet10-upgrade
Open

Upgrade project to .NET 10 and modernize CI#5
gluschenko wants to merge 4 commits into
masterfrom
dotnet10-upgrade

Conversation

@gluschenko

Copy link
Copy Markdown
Owner

Add global.json to pin .NET SDK 10.0 and roll forward to latestFeature. Bump project TargetFrameworks to net10.0 / net10.0-windows and update BenchmarkDotNet and Microsoft.Extensions package versions to 0.15.6 and 10.0.8 respectively. Update solution VisualStudioVersion to 18.0.0.0. Modernize GitHub Actions usage (actions/checkout, setup-dotnet, upload/download-artifact) to v4 and switch workflow dotnet-version to 10.0.x. Small formatting/newline fix in RenderBox.csproj. These changes move the codebase and CI to .NET 10 and newer action versions.

Add global.json to pin .NET SDK 10.0 and roll forward to latestFeature. Bump project TargetFrameworks to net10.0 / net10.0-windows and update BenchmarkDotNet and Microsoft.Extensions package versions to 0.15.6 and 10.0.8 respectively. Update solution VisualStudioVersion to 18.0.0.0. Modernize GitHub Actions usage (actions/checkout, setup-dotnet, upload/download-artifact) to v4 and switch workflow dotnet-version to 10.0.x. Small formatting/newline fix in RenderBox.csproj. These changes move the codebase and CI to .NET 10 and newer action versions.
Introduce nullable annotations and null-safety checks across the codebase. Key changes:

- Updated Equals signatures to accept nullable object? and simplified equality checks for Vector/Quaternion types.
- Initialized several Camera matrices (ViewMatrix, PosMatrix, ViewPosMatrix, RayMatrix) to avoid uninitialized state.
- Made shape/light references nullable where appropriate: Shape.Light, Ray.HitObject, MandelbrotRenderer.Filter, Paint.Bitmap, various renderer/thread fields and events, and Scene.Lights now defaults to an empty collection.
- Hardened PathTraceRenderer: changed TracePath/FindClosestHit/IsShadow signatures to accept nullable currentShape, added null guards and casts (throwing on unexpected null Hit.HitObject) and adjusted lighting/shadow logic to use the non-null hit object.
- Streamlined Scene.UpdateLights to filter null lights safely.
- ThreadManager: initialize pool to Array.Empty, make onDone nullable, simplify Kill and worker invocation logic.
- Renderer/Pages: make GetOptionPageType and other APIs nullable-aware, add defensive checks in CanvasPage.SetupRender and Render, initialize page renderer sources with null-forgiving pattern where necessary, and ensure option page instances are validated before invoking.
- Minor refactors and safety improvements (type checks in MandelbrotPage filter handling, removed unused imports).

These changes reduce potential null-reference crashes and make intent clearer for nullable reference types.
Introduce Matrix4x4 with rotation, multiplication and transform helpers and add Rotation properties to Camera and Shape. Implement local/world point and direction transforms and inverse via transpose to support rotated shapes. Update Sphere, Mesh and Box to transform rays, positions, normals and light emission correctly (Mesh now tests triangles in local space and converts hits back to world space; SetData keeps local vertices). Add Camera.TransformDirection and rotation setters (degrees/radians) and wire camera rotation controls in the renderer. Update CornellBox to demonstrate rotated boxes.
Improve null-safety across the path tracer and UI pages.

- Light.cs: change Shape from IShape with null-forgiving to nullable Shape?.
- Scene.cs: tighten UpdateLights filter to require x?.Shape is not null before casting to Light.
- DrawingPage, MandelbrotPage, PathTracePage: make backing renderer fields nullable, add a guarded Source property that throws if UseSource wasn't called, and update all usages to go through Source to avoid null-forgiving fields and NREs.

These changes make initialization expectations explicit and reduce unsafe null assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant