Upgrade project to .NET 10 and modernize CI#5
Open
gluschenko wants to merge 4 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.